Hi

I would like to share my trick to debugger Jquery with FireBug.

It isnt advanced but could be useful to start debugg Jquery Code.

So your page load and now you will start a lot of functions and in the
middle of ones you want do,

$("#mytarget").append($("something"));

(or more complicate tasks)

So before you start run this function (for example into an AJAX requisition)
you want create a BreakPoint,

So you go to FireBug/Scripts and create a breakpoint. (see
http://www.getfirebug.com/js.html)

The problem: You can't see what $("#mytarget").append($("something"));
did   (look, it is a simple example, imagine complicate tasks)

So you should create a variable like:

var test = $("#mytarget").append($("something"));

So you can mouse over "test" and see what this function did. You can see in
the tab "watch" and see the result.

Nice but I am not a Javascript Ninja but seems to be a good reason why
Javascript programmers love use "var" because turn easy the job in the
debugg stage but $this comment I will let to advanced programmers.

So we should create our JQuery functions always with varaibles to turn our
job easy? Exist a "best pratice" to create variables in Javascript world?

Hope be useful

Regards

Mario Moura
macm

Reply via email to