Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I am trying to do it like this which has worked for me before but is not working for me now.
$("input").attr('disabled','disabled');
Can anyone tel me why it is not working while it has worked for me in previous projects.
element.disabled = true
What you are doing is old style was applicable for Jquery 1.5 and below. For version 1.6 and above you need to write this
$("input").prop('disabled', true);
Hope it helps.
Add a comment
You must have upgraded to newer version of jQuery which is greater than 1.5. For jQuery greater than 1.5, attr will not work but need to use prop as shown below.
attr
prop
$("input").prop('disabled','disabled');
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
element.disabled = true