在Firefox中点击事件 [英] On click event in firefox

查看:118
本文介绍了在Firefox中点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上有一个复选框,ID为'checkbox1'。我使用查询来执行一些命令,当用户做出如下所示的选择:

$ $ $ $ $'$ checkbox1'。on 'click',函数(e){
//命令去这里
});

在firefox中,当用户点击复选框箭头时,我不要那个。我希望它只响应选择。在safari中,我没有这个问题。当我点击箭头时,只有当我做出选择时,事件才会启动。我怎么解决这个问题?感谢。

解决方案

change() 事件,使用它:

<$ p $($#$ c $)$('#checkbox1')。on('change',function(e){
//命令去这里
});


I have a check box in my web site with the id 'checkbox1'. I use query to perform some commands when the user makes a selection like so:

$('#checkbox1').on('click', function(e) {
     //commands go here
});

In firefox the event handler kicks in when the user clicks on the checkbox arrow. I don't want that. I want it to respond to selections only. In safari I don't have this problem. The event doesn't kick in when I click the arrow, only when i make a selection. How can I solve this problem? Thanks.

解决方案

What about change() event, use it:

$('#checkbox1').on('change', function(e) {
     //commands go here
});

这篇关于在Firefox中点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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