Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove disabled attribute from textbox during run time

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.
like image 672
yogeswaran K Avatar asked Mar 27 '12 06:03

yogeswaran K


People also ask

How do I remove disabled attributes?

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.

How do I remove input field Disabled?

Approach 1: Select the input element and use disabled property and set its value to false.

How to disable attribute in js?

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.

How do I know if a textbox is disabled?

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 .


1 Answers

Use $(document).ready-

$(document).ready(function(){
     $('#Yes').removeAttr("disabled");
});

Fiddle: http://jsfiddle.net/HfXBE/

like image 149
nickalchemist Avatar answered Nov 15 '22 04:11

nickalchemist