如何在事件挂接时不显眼地发现 JavaScript 正在运行

发布于 2024-12-18 13:23:58 字数 281 浏览 5 评论 0原文

我正在开发一个包含复选框的网页,这些复选框在单击或更改时会执行一些操作。 HTML 本身没有显式的事件绑定。我实际上不知道事件绑定是如何完成的,也无法找到当复选框更改时正在运行的 JavaScript(除了页面在其他地方使用 jQuery 之外)。

JavaScript 本身分布在 HTML 本身的多个位置,以及一大堆附加的 JavaScript 文件中。这会让在 JavaScript 中到处粘贴断点变得困难。

有没有什么办法,例如使用一些调试环境,来找出当我更改这些复选框的值时运行的 JavaScript?

I am working on a web page that contains check boxes that do some stuff when they are clicked, or changed. There is no explicit event binding in the HTML itself. I have literally no idea how the event binding has been done and no way to find what JavaScript is being run when the checkboxes are changed (other than the page uses jQuery in other places).

The JavaScript itself is spread out in several locations in the HTML itself, plus in a whole bunch of additional JavaScript files. This would make just sticking breakpoints everywhere in the JavaScript difficult.

Is there any way, using some debugging environment for example, to find out what JavaScript is run when I change the values of these checkboxes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半仙 2024-12-25 13:23:58

转到 Google Chrome 开发人员工具中的脚本选项卡,并将事件监听器断点设置为 change 事件(或单击事件,无论它们使用什么),然后单击复选框。然后它会立即停止执行,您可以手动逐个函数地完成整个执行过程。

Go to scripts tab in google chrome developer tools and set an Event Listener Breakpoint to a change event (or click event, whatever they are using) and go click a checkbox. It will then stop execution right away and you may manually walk through the whole execution process, function by function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文