JavaScript and I share initials, ya know? It never worked for me until I spent a summer writing a JavaScript/jQuery/AJAX-goodness webapp. We've moved passed our differences and are now good friends.

There are several tools that are hella helpful for javascript work. As the whiteboard in this room says "Javascript is a passive-aggressive programming language. Other languages yell at you if they don't like what you're telling them. Javascript just ignores you."

An awesome online tool that analyzes your JavaScript code, and tells you what's wrong with it, both syntactically and stylistically.

You need this! Along with a JavaScript debugger, it's extremely useful for CSS/HTML stuff, and under the 'Net' tab, you can view the JSON your server-side scripts are sending back.

The one for Firefox works best. I have one for Chrome, but it seems a bit buggy.

Firebug just keeps making me happier.

Using console.log and its relatives, one can dump JavaScript information into the already-helpful Console. Print statements for JavaScript, that don't make me click 'ok' like those darn alerts!
Be sure to wrap console.log in something like if (window.console), since this is undefined when firebug isn't running.

Check out the Firebug's page on logging for more details.

When using jQuery's .bind (or the shortcuts, .click and the like), it tends to be a good idea to .unbind the event first to avoid accidentally binding it more than once.

Also, you can create custom events using jQuery's .bind and .trigger combo. This can be useful if you want something to happen that's triggered by something like a key-combo that could happen anywhere on the page.

[View 0 Comments] [Post a comment]