jQuery .attr("disabled", "disabled") not working in Chrome
Solution 1:
If you are using jQuery < 1.6 do this:
jQuery("input[type='text']").attr("disabled", 'disabled');
If you are using jQuery 1.6+:
jQuery("input[type='text']").prop("disabled", true);
See this question: .prop() vs .attr() for references why.
Or you can try this:
$('input:text').attr("disabled", 'disabled');
see here for info on :text
Solution 2:
For me, none of these answers worked, but I finally found one that did.
I needed this for IE-
$('input:text').attr("disabled", 'disabled');
I also had to add this for Chrome and Firefox -
$('input:text').AddClass("notactive");
and this -
<style type="text/css">
.notactive {
pointer-events: none;
cursor: default;
}
</style>
Solution 3:
if you are removing all disabled attributes from input, then why not just do:
$("input").removeAttr('disabled');
Then after ajax success:
$("input[type='text']").attr('disabled', true);
Make sure you use remove the disabled attribute before submit, or it won't submit that data. If you need to submit it before changing, you need to use readonly instead.
Solution 4:
It's an old post but I none of this solution worked for me so I'm posting my solution if anyone find this helpful.
I just had the same problem.
In my case the control I needed to disable was a user control with child dropdowns which I could disable in IE but not in chrome.
my solution was to disable each child object, not just the usercontrol, with that code:
$('#controlName').find('*').each(function () { $(this).attr("disabled", true); })
It's working for me in chrome now.