防止复选框勾选/检查完全 [英] Prevent checkbox from ticking/checking COMPLETELY

查看:249
本文介绍了防止复选框勾选/检查完全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求禁用复选框的滴答。我没有被要求禁用复选框,而只是禁用ticking。

I have been asked to disable the "ticking" of a checkbox. I am not being asked to disable the checkbox, but to simply disable the "ticking".

换句话说,用户会 认为复选框是可勾选的,但不是。相反,点击复选框将导致模态对话框出现,给用户更多的选项来打开或关闭复选框表示的功能。如果在对话框中选择的选项使该功能打开,那么复选框将被勾选。

In other words, a user will think that a checkbox is tickable, but it is not. Instead, clicking on the checkbox will cause a modal dialog to appear, giving the user more options to turn on or off the feature that the checkbox represents. If the options chosen in the dialog cause the feature to be turned on, then the checkbox will be ticked.

现在,真正的问题是,

Now, the real problem is that for a split second, you can still see that the checkbox is being ticked.

我已尝试过这样的方法:

I have tried an approach like this:

<input type='checkbox' onclick='return false' onkeydown='return false' />

$('input[type="checkbox"]').click(function(event) {
    event.preventDefault();
    alert('Break');
});

如果运行此操作,将会出现警报,显示刻度线是可见的有证明它仍然会得到打勾,在生产中,警报不存在)。对于使用较慢机器和/或使用慢速渲染器/ javascript的浏览器的一些用户,用户可以看到非常微弱的闪烁(闪烁有时持续半秒,这是显而易见的)。

If you run this, the alert will appear, showing that the tick is visible (the alert is just there to demonstrate that it still does get ticked, in production, the alert is not there). On some users with slower machines and/or in browsers with slow renderers/javascript, users can see a very faint flicker (the flicker sometimes lasts for half a second, which is noticeable).

我的团队中的测试员已将此标记为缺陷,我应该修复它。

A tester in my team has flagged this as a defect and I am supposed to fix it. I'm not sure what else I can try to prevent the tick in the checkbox from flickering!

推荐答案

尝试

event.stopPropagation();

http: //jsfiddle.net/DrKfE/3/

这篇关于防止复选框勾选/检查完全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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