查找在Web浏览器中触发事件的jQuery代码 [英] Find jQuery code that trigger then event in Web Browser

查看:153
本文介绍了查找在Web浏览器中触发事件的jQuery代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我加入了一个团队来完成一个项目。现在他们使用jQuery,而且很多JavaScript文件都是外部文件,而不是嵌入的。



当我点击一个按钮时,它看起来像:

 < a class =button_cancel>取消< / a> 

它触发一个在一个javascript文件中定义的事件。



当触发onclick时,是否有办法找到文件(甚至是文件的确切位置)? 解决方案 div>

Visual Event 2 可以为您提供这些信息
$ b


Visual Event是一个开源的Javascript小书签,提供
有关事件的调试信息已附加到DOM
元素。 Visual Event显示:


  • 哪些元素附有事件
  • 附加到事件的类型元素

  • 触发事件的代码被触发

  • 附加函数定义位置的源文件和行号(Webkit浏览器和Opera)


演示


I joined a team to work on a project. Now that they use jQuery and a lot of the javascript file are external files instead of embedded.

When I clicked a button, which simply looks like:

<a class="button_cancel">Cancel</a>

It trigger an event which is defined in one javascript file.

Is there a way to locate the file (or even the exact line of the file) when the onclick is triggered?

解决方案

Visual Event 2 can provide you with this informations in a nice and easy to use way.

Visual Event is an open source Javascript bookmarklet which provides debugging information about events that have been attached to DOM elements. Visual Event shows:

  • Which elements have events attached to them
  • The type of events attached to an element
  • The code that will be run with the event is triggered
  • The source file and line number for where the attached function was defined (Webkit browsers and Opera only)

Demo

这篇关于查找在Web浏览器中触发事件的jQuery代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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