开发者

Best way to trace Javascript code [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

What is the best way to debug Javascript code using any tool..i.e. i want to know when a button is clicked, what all JS code gets executed...

I wanted to test in Firefox and Safari..Already tried Firebug, but want to know if there is any better way开发者_开发问答..

Also more importantly i want to know "how" exactly to debug the code?

Also is it possible to print the complete JS code that gets called when I say press a button?


I always use the integrated web inspector tool from Google Chrome (you know, right-click, Inspect element). It works quite well for me, and has all the functions I need.


This post, using FireFox's FireBug and jQuery, might help you detect and capture all of the events bound to a button so you can tell what JS code is run when the button is clicked:

How to debug JavaScript/jQuery event bindings with Firebug (or similar tool)


Chrome Developer Console + Firefox Firebug of course (and Firebug Lite in IE), but also check out Visual Event, a bookmarklet that show you a highly visual overview of events attached to elements of your page.


Well, I think that the best method is using Visual Studio and hooking it with Internet Explorer. As many others have pointed out, the browser built-in tools are great, but visual studio lets you debug javascript code and edit it with same application. The downside is that you must use Internet Explorer, but personally I don't find it to be such a big problem.


Chrome Developer Console + Firefox Firebug

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜