开发者

jQuery: removeAttr("disabled") not working on Firefox

I have some code that looks like the followi开发者_运维知识库ng coming back from an XHR response:

jQuery(':text:not(:hidden)').removeAttr("disabled");

This is a result of input fields being disabled after form submit. The XHR response returns this tidbit of jQuery and re-enables controls. Works great on every browser, even "partially" on FF 3.6.1 OSX. What I mean by partially is that some text fields have the disabled attribute removed, others do not. These text fields are verified not hidden.


Have a go using this instead:

jQuery('input:text:visible').each(function(){
    this.disabled = false;
});

This uses the disabled property of the element directly, rather than messing around with jQuery wrappers.


Did you try something like:

jQuery('input[type=text]:visible').removeAttr("disabled");


Instead try:

jQuery(':text:not(:hidden)').attr("disabled",'');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜