Solved

how do I debug jQuery?

Posted on 2011-09-15
12
374 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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
 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

786 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