FireFox处理禁用的字段 [英] FireFox handling of disabled fields

查看:131
本文介绍了FireFox处理禁用的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有选择列表和单选按钮的HTML表单,这两个表单最初都设置为disabled = true。在某些时候,这些元素通过JavaScript被启用(即,disabled = false)。这在IE和Chrome中运行良好,但是在FireFox中元素保持禁用状态。它似乎已启用,但不响应鼠标点击。当我使用FireBug检查其中一个元素时,disabled属性为false。 FireFox在处理最初禁用的表单元素时是否存在已知的问题,然后启用?



谢谢

解决方案

我能够通过使用jQuery来设置和删除disabled属性而不是直接设置它来解决这个问题。

$ $ $(control).attr('disabled' ,禁用);
$(control).removeAttr('disabled');


I have an HTML form with a select list and a radio button, both of which are initially set with disabled = true. At some point, these elements are enabled via JavaScript (i.e., disabled = false). This works fine in IE and Chrome, but in FireFox the element remains disabled. It appears to be enabled, but doesn't respond to mouse clicks. When I inspect one of the elements using FireBug, the disabled attribute is false. Are there known issues with FireFox when dealing with form elements that are initially disabled, then enabled?

Thanks.

解决方案

I was able to resolve this issue by using jQuery to set and remove the disabled attribute rather than setting it directly. I'm not sure what it does under the hood to make it work.

$(control).attr('disabled', 'disabled');
$(control).removeAttr('disabled');

这篇关于FireFox处理禁用的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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