attr disabled property is not working for FF
-
Hi, i like to disable the buttons on check of the checkbox....using Jquery i have tried in 3 different ways... 1.attr("disabled", true)-- working in IE not in FF 2.attr("disabled", "disabled")- working in IE not in FF 3.attr("diabled") not working in both... i want to know the property which is supported by all the browsers(like safari, chrome etc..) thanks in advance
-
Hi, i like to disable the buttons on check of the checkbox....using Jquery i have tried in 3 different ways... 1.attr("disabled", true)-- working in IE not in FF 2.attr("disabled", "disabled")- working in IE not in FF 3.attr("diabled") not working in both... i want to know the property which is supported by all the browsers(like safari, chrome etc..) thanks in advance
I suspect the problem is somewhere else.
$('#id').attr('disabled',true)
is working for me in FireFox, IE, Chrome and Opera. Setting it back to 'false' enables the inputs again. -
Hi, i like to disable the buttons on check of the checkbox....using Jquery i have tried in 3 different ways... 1.attr("disabled", true)-- working in IE not in FF 2.attr("disabled", "disabled")- working in IE not in FF 3.attr("diabled") not working in both... i want to know the property which is supported by all the browsers(like safari, chrome etc..) thanks in advance
I agree with graham I tested with below code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<input type='checkbox' value='10' id='id'> <label for='id'>Test Checkbox</label>
<BUTTON onclick='a=!($("#id").attr("disabled")); $("#id").attr("disabled",a)'>
test
</BUTTON>it work fine
-
Hi, i like to disable the buttons on check of the checkbox....using Jquery i have tried in 3 different ways... 1.attr("disabled", true)-- working in IE not in FF 2.attr("disabled", "disabled")- working in IE not in FF 3.attr("diabled") not working in both... i want to know the property which is supported by all the browsers(like safari, chrome etc..) thanks in advance
The code you are using has always worked for me so not sure what's wrong but as a point, the second one in your list is the correct one. If you are trying to enable the check boxes again you will have to use the
removeAttr
method as W3 standards say that the mere presence of thedisabled
attribute means the control is disabled, regardless of value (which some of the major browsers follow). As for why your check boxes don't disable I can only suggest that IE and FF are handling your HTML differently (check Id's are the same, that you are only trying to set the disabled attribute after full page load (use $(document).ready if you aren't!) etc. etc.) Hope this helps, Ed -
I agree with graham I tested with below code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<input type='checkbox' value='10' id='id'> <label for='id'>Test Checkbox</label>
<BUTTON onclick='a=!($("#id").attr("disabled")); $("#id").attr("disabled",a)'>
test
</BUTTON>it work fine