Firebug: Logging JavaScript variables and output

Firebug adds a handy global variable called "console" to your page, which you can use to print stuff into the console window.

var body = $('body');
console.debug(body);

In the console window you can browse the variable you've printed.

image

Clicking on the object will take you to the DOM tab, which will allow you to explore the information contained within the variable.

image

There are a number of other functions such as console.dir() which displays all the properties of the object and console.trace() which shows you the stack trace.

You can see the full list of functions here.

[ Source ]

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog