Until now I was using the following to disable/enable form fields –
$('#fieldid').attr('disable','disable');
$('#fieldid').removeAttr('disable');
And that got the job done. But yesterday, I absent-mindedly typed the following to enable the field –
$('#fieldid').enable();
And it worked! I silently kicked myself for not trying the the handy ‘enable’/’disable’ functions built into jQuery (or so I thought), and proceeded to change the line to disable to –
$('#fieldid').disable();
And to my surprise, that did NOT work.
Am I missing something? Why is the enable() function defined but the disable() function is not? And even weirder, I could find no mention of either enable() or disable() in the jquery docs. Does anyone have any explanations?
I’m using jQuery 1.6.
jQuery does not support an
enable()method out of the box (and thedisableHTML attribute does not exist either, but that might only be a typo in your question).Maybe you’re using a plug-in that provides that feature? If that’s the case, try passing
falseto theenable()method to disable a field: