Solved

how do I debug jQuery?

Posted on 2011-09-15
12
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to combine and minify CSS and JS files 5 37
testing a web application for ipad on windows pc 3 35
Table style position to the left 8 24
Slush on text 2 10
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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

762 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