Javascript debug logging

Try calling "console.log", this will log some message to the console. The console isnt avalible for the ordinary user, but when you are using a browser that supports the console, it'll be written to this.

The console.log function is supported by Firebug for Firefox, and for webkit browsers as Safari and Google Chrome.


jQuery("#button").click(function() {
     console.log("#button was clicked"); 

The above code will write "#button was clickd" to the console.

Important note, remember to check if the console.log is avalible, before using it, therefore eighter do a if(console.log), or make your own function that outputs to the console, checking the avalibility of the function. The reason you need to do a check is ofcurse, Internet Explorer, who doesnt support the command, and will break your javascript if used inproperly.