如何使用 removeClass 解决状态按钮中的 jquery ui / firefox 错误
How to solve jquery ui / firefox bug in state button with removeClass?
我限制了选中复选框的数量,但火狐浏览器上的样式不正确。实际上火狐上有一个带有状态按钮的错误,请参阅火狐上的这个示例,当您双击按钮时,如果 lengh> 3(在这种情况下),状态更新得不好,所以我尝试删除 ui 状态类,但它不起作用,有人有解决方案吗?!
http://jsfiddle.net/mbAwC/22/
$('.limit :checkbox').change(function () {
var $cs=$(this).closest('.limit').find(':checkbox:checked');
if ($cs.length > 3) {
$(this).prop('checked', false).removeClass("ui-state-active ui-state-hover ui-state-focus").button('refresh');
问候杰西
这是一个奇怪的错误,因为它发生在双击事件中。这就是您的代码不起作用的原因,因为在双击时不会发生"更改"事件。因此,您无法更改状态并删除"onchange"中的类。为了解决这个有趣的问题,我尝试像这样添加sth:
$('.limit label').dblclick(function () {
if (!$(this).is(':checked'))
{
$(this).removeClass("ui-state-active ui-state-hover ui-state-focus ");
}
});
这将处理奇怪的双击,并在样式未选中的复选框上错误地应用样式时删除样式。
相关文章:
- jQuery UI自动完成突然停止工作
- Rails/JSON:如何将JSON用于jquery UI自动完成表单
- 停止jQuery UI滑块移动超过给定值
- Jquery UI自动完成无法工作
- jquery ui滑块上的滑块值
- jQuery UI可排序-多连接列表拖动
- 使用Jquery ui时滑块无法工作
- JQuery UI可拖动潜水与滚动棒到鼠标
- jQuery UI自动完成-修改问题
- JQuery UI日期选择器:在选择出发日期时自动弹出返回日期
- 阻止选项卡缓存jquery ui
- 将jQuery UI Timepicker Addon与React一起使用
- 如何在页面重新加载时显示jquery ui对话框
- jquery ui自动完成导致标头错误
- jquery UI draggable:UI.children不是一个函数
- 在JQuery UI Accordion Sortable中使用touchpunch无法正确使用touch
- Jquery UI对话框不会消失
- 无限循环onsen UI + jquery
- Ignite UI - (jQuery) - 无法使用 ig.excel.WorksheetCellComment 在单
- 可排序的UI jquery的奇怪行为