jQuery:removeAttr(" disabled")无法在Firefox上运行 [英] jQuery: removeAttr("disabled") not working on Firefox

查看:54
本文介绍了jQuery:removeAttr(" disabled")无法在Firefox上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码看起来像是从XHR回复中回来的:

I have some code that looks like the following coming back from an XHR response:

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

这是在表单提交后禁用输入字段的结果。 XHR响应返回jQuery的这个小节点并重新启用控件。适用于所有浏览器,甚至可以部分在FF 3.6.1 OSX上运行。我的意思是部分文本字段删除了禁用属性,其他文本字段没有删除。验证这些文本字段不被隐藏。

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.

推荐答案

请改用它:

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

这使用元素的已禁用属性直接而不是搞乱jQuery包装器。

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

这篇关于jQuery:removeAttr(" disabled")无法在Firefox上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆