Solved

how do I debug jQuery?

Posted on 2011-09-15
12
372 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

867 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

16 Experts available now in Live!

Get 1:1 Help Now