I am solving following situation - I have in table in database data and where by these data I have in HTML page checked or unche开发者_Python百科cked checkboxes.
I am wonder about the procedure, how to do, if I have checked checkbox, so how to disable to user unchecked this checkbox..
Exist some way, how to do?
Thanks a lot, M.
Just use HTML:
<input type="checkbox" checked disabled>
Note that the readonly
attribute in HTML cannot be used with checkbox inputs.
After check on checkbox app attr disabled on checkbox.
.attr('disabled', true);
If you mean you want checkboxes that are checked to be disabled, you can use the disabled
attribute:
<input type="checkbox" disabled="disabled" />
If you want to disable a checkbox when it is clicked, with jQuery, you can do this:
$("input[type=checkbox]").click(function() {
$(this).attr("disabled", true);
});
$(checkbox).attr('readonly', true); Where "checkbox" is appropriate jQuery selector, don't use this code literally
精彩评论