javascript如何阻止click事件连续触发

中包含一个checkbox,点击时不仅激活checkbox的click事件,还会激活td或者tr的click事件,称作bubble event。

解决方法是:

$(“table tbody td”).click(function(e){
if(e.target.nodeName.toUpperCase() == “INPUT”){
alert(“It’s an input!”);
return;
}else{
alert(“It’s not an input!”);
}
});

Firefox 调试 插件/扩展

在一个项目中要开发一个firefox的扩展,结果一直没找到好的调试方法,痛苦的要命。之前在网上找到用chromebug,试了很多次都没有成功,只好在代码里面用代码打印到控制台。

项目已经过去了很久,最近需要修改点代码,重新遇到调试的问题,在网上又搜了一遍,找到了一个方法,测试了一下,居然可以设置断点调试了,可喜可贺。

方法就是修改firefox的设置,在地址栏输入about:config,然后允许chrome调试和远程调试:

devtools.chrome.enable => true

devtools.debugger.remote-enable => true

然后在firefox里Tools > Web Developer > Browser Console.,打开调试窗口,里面有个debugger,这里就可以开始了。

 

以下是原文和地址

http://stackoverflow.com/questions/17547364/how-to-debug-a-firefox-extension-with-chromebug/17579253#17579253

Update April 2014: The browser debugger is now integrated in the “Browser Toolbox” and you no longer need to set about:config prefs. Just use the developer tools configuration/settings panel: “enable chrome debugging” and “enable remote debugging”. The “Browser Toolbox” will then be available in the developer tools panel.

Chromebug has not worked for me for many months. I think it’s just been silently abandoned but thankfully on Firefox 19 or later, it’s possible to use the built-in JS debugger on the browser itself. Go to about:config and set the following two prefs:

devtools.chrome.enabled: true
devtools.debugger.remote-enabled: true

After you restart the browser, the Web Developer menu will contain a “Browser Debugger” entry.

More info here: https://developer.mozilla.org/en/docs/Debugging_JavaScript

If possible, I’d suggest using Aurora for your debugging because the built-in debugger was a little limited when first launched and keeps getting better with every release.