Friday, 26 March 2010

How do I disable/enable an element?

You can disable/enable an element by setting the 'disabled' attribute to 'disabled' (to disable it) or "" (to enable it). The result of which looks something like this:

// Disable #divID
$("#divID").attr("disabled","disabled");
 
// Enable #divID
$("#divID").removeAttr("disabled");
Cheers!

No comments:

Post a Comment