December 2013
Intermediate to advanced
384 pages
9h 54m
English
$("#cbSame").on("click", function(){ if($(this).is(":checked")){ $("#billInfo :input").attr("disabled",true); } else { $("#billInfo :input").removeAttr("disabled"); } });
Disabling web elements still displays them, but it prevents the user from interacting with them. Typically, it only makes sense to disable a form element instead of disable it if you still want the user to be able to see the values of the elements.
To disable a form element, you need to set the disabled attribute. In JavaScript, you can do this directly on the DOM object. In jQuery, you use the .attr() method. For example:
$("#deadElement").attr("disabled", "disabled");
Read now
Unlock full access