Solved

how do I debug jQuery?

Posted on 2011-09-15
12
371 Views
Last Modified: 2012-05-12
I know  how to stop at a breakpoint in JavaScript. but when i set a breakpoint in jQuery the whole function is a single breakpoint.

Is there a way around this?

Thanks!
0
Comment
Question by:newbieweb
  • 5
  • 5
  • 2
12 Comments
 
LVL 8

Assisted Solution

by:crysallus
crysallus earned 200 total points
ID: 36546125
If you wish to debug the internals of a jquery function, simply download the full source version (look for the Uncompressed links), then you can set break points in the jquery code just like any other javascript file.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 300 total points
ID: 36546202
Check this : http://code.jquery.com/jquery-1.6.4.min.js
and this : http://code.jquery.com/jquery-1.6.4.js

this is the same version but you should use the last one to deug (set break point)
the first one is a mimified version, a lighter version

http://jscompress.com/
0
 

Author Comment

by:newbieweb
ID: 36546430
What if it's only my jQuery I want to debug?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36546441
just place "debugger;" keyword in your own jQuery
0
 

Author Comment

by:newbieweb
ID: 36546842
> just place "debugger;" keyword in your own jQuery

Where do I place "debugger"?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36546843
anywhere you want to stop the code to debug (see current value)
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:newbieweb
ID: 36546848
I have no idea what you mean. I thought I could place a breakpoint, but it lighlighted the whole jquery function.

Confused...
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36546852
you debug jQuery by opening the jQuery file not by debugging the code using the jQuery functions

if you need to debug :
$(".xxx").html()

you have nothing to do with YOUR script, you need to use a not minimified jQuery.js, search for the jquery.html function and place your breakpoints (or debugger keyword) in this file (jQuery-1.x.x.js)
0
 
LVL 8

Expert Comment

by:crysallus
ID: 36546856
What debugger are you using? Firebug (what I normally use)?

Perhaps some screenshots might clarify what your issue is, and what you are trying to do. Or some of your code perhaps.
0
 

Author Comment

by:newbieweb
ID: 36546857
That's how I open the file, from the top of Visual Studio 2010, which shows all the scripts rendered to the browser.

Inside that file, I tried to set the breakpoint inside a jquery function, but the whole function became red...
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36546885
please post a screen copy
0
 

Author Closing Comment

by:newbieweb
ID: 36548728
Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now