简体   繁体   中英

jQuery: removeAttr(“disabled”) not working on Firefox

I have some code that looks like the following 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.

你尝试过这样的事情:

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

而是尝试:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM