How to remove disabled attribute from textbox in asp.net MVC during run time
In Html format
<input id="Yes" type="radio" value="Yes" tabindex="8" name="rdoRecommend" disabled="">
$('#Yes').removeAttr("disabled"); is not working.
To remove the disabled attribute, select the element and call the removeAttribute() method on it, passing it disabled as a parameter, e.g. btn. removeAttribute('disabled') . The removeAttribute method will remove the disabled attribute from the element.
Approach 1: Select the input element and use disabled property and set its value to false.
To set the disabled attribute, select the element and call the setAttribute() method on it, passing it disabled as the first parameter, e.g. button. setAttribute('disabled', '') . The setAttribute method will add the disabled attribute to the element.
You can use $(":disabled") to select all disabled items in the current context. To determine whether a single item is disabled you can use $("#textbox1").is(":disabled") . Show activity on this post. With boolean comparison there is no need to test against true or false .
Use $(document).ready-
$(document).ready(function(){
$('#Yes').removeAttr("disabled");
});
Fiddle: http://jsfiddle.net/HfXBE/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With