点击Chrome时,复选框无法获得焦点 [英] Checkboxes do not receive the focus when clicked on Chrome
本文介绍了点击Chrome时,复选框无法获得焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚在Chrome上遇到了另一个奇怪的行为:当您点击复选框或其标签时,该复选框不会收到焦点(而是正文会显示焦点)。
I just came across another strange behaviour on Chrome: when you click a checkbox or its label, the checkbox does not receive the focus (instead the body takes the focus).
这种行为可以在这里观察到: http://jsfiddle.net/YfbR7/7/ (请参阅此处的代码示例
)
This behaviour can be observed here: http://jsfiddle.net/YfbR7/7/ (see code sample here
)
是否有任何解决方法使复选框接收焦点,浏览器?
Is there any workaround to make the checkbox receive the focus, like on the other browsers?
推荐答案
您也可以像这样解决
$(function () {
$("input[type=checkbox]").click(function (event) {
$(this).parent().css("background", "red");
});
})
这篇关于点击Chrome时,复选框无法获得焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文