开发者

Is there a visual 'debug' tool for jQuery?

I'm having an issue with jQuery not traversing to my elements in a specific section of my code where it works everywhere else flawlessly. I am wondering if there a visual tool of sorts (for any browser although I prefer Chrome), that will show me exactly what jQuery is doing as it hops through the elements?

EDIT So, I should probably make this clearer.

I can use the built in debuggers just fine, however it just shows me the functions that jQuery is calling - not the actual elements that it 开发者_JS百科is looking at. I would like to see what it is actually looking at in the DOM because this code works in 4 other places with exactly the same HTML structure but it keeps failing in the fifth place that it is used.

Hopefully that makes more sense?


FireQuery for Firefox/Firebug could help identify which elements have jQuery events attached. If only it could resolve those to actual functions.


The best way to debug javascript is use the built in tools in IE, Chrome and Firefox. You can also use FireBug which provides a lot more information. I use firebug almost daily to debug more than just Javascript


try Blackbird. It's great for JS/jquery debugging. It can be hidden and left in production and shown with a hot key [F2]


Firebug :) You can use console.log("Put text here / or variables")
It then shows up in the firebug "console" screen: http://getfirebug.com/


Hey I would check out QUnit. You have to write your own unit tests but it should allow you to examine and traverse the DOM however you want.


As far as I know, there isn't a tool that does what you want, although it would be very good.

Other solutions:

Some people don't like this way of debugging, but put alert()s in strategic places in your code to output values from certain variables.

Update As James Gregory says in the comments, console.log() would be much better than alert()s all over the place.

Another method is what I do, which is to add a <div id="debug"> in a nicely visible place on the page, then .append() values and other stuff to it to see what's going on.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜