How to remove a disabled attribute from a text field at run time

How to remove a disabled attribute from a text box in asp.net MVC at run time

HTML format

<input id="Yes" type="radio" value="Yes" tabindex="8" name="rdoRecommend" disabled=""> $('#Yes').removeAttr("disabled"); is not working. 
+4
source share
3 answers

Use $ (document) .ready -

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

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

+8
source

$('#Yes').removeAttr("disabled"); must work. The question is, are you calling at the right time? For example, did you guarantee that the DOM is ready before you call it? Like this:

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

As you can see in this live demo , it works great.

+3
source

Do you put your jquery statement in the callback of a loaded event?

http://jsfiddle.net/tWxhh/

0
source

Source: https://habr.com/ru/post/1403588/


All Articles