This code is a direct copy-paste from the jquery#faq page
<select id="x" style="width:200px;">
<option>one</option>
<option>two</option>
</select>
<input type="button" value="Disable" onclick="$('#x').attr('disabled','disabled')"/>
<input type="button" value="Enable" onclick="$('#x').removeAttr('disabled')"/>
The select option list is getting disabled on first click to disable, but not getting enabled again on clicking the Enable button.
Please let me know, what is wrong with above piece of code?
I am using Chrome 23.0.1271.64 on windows.
You are correct about there being a bug on the official jQuery page. Viewing the source for that page shows that this is the actual code:
As you can see, the
onclickcode is incorrect; to enable a control (according to the jQuery FAQ) thedisabledattribute should either be set tofalseor removed using$(..).removeAttr().