开发者

Why can't I remove the "disabled" attribute from a textarea using jQuery?

开发者 https://www.devze.com 2023-03-05 07:43 出处:网络
It works when I remove the disabled attribute on an input type tex开发者_StackOverflow社区t field but not textarea, why?

It works when I remove the disabled attribute on an input type tex开发者_StackOverflow社区t field but not textarea, why?

I set the textarea to be disabled like this:

    $('#message').attr('disabled', 'disabled');

which worked, but then later when I did this:

$('#message').removeAttr('disabled');

no luck.

The HTML:

     <textarea id="message">Type here...</textarea>


I'm not seeing what you're saying is happening:

<textarea id="message" disabled="disabled">Type here...</textarea>

<input type="button" value="Enable Me!" />

$(":button").click(function(){
    $("#message").removeAttr("disabled");
});

http://jsfiddle.net/hunter/TRKzQ/


I'm guessing some other javascript error is happening. Is there more code?

0

精彩评论

暂无评论...
验证码 换一张
取 消