Jquery best practices
Filed Under (jquery) by admin on 08-10-2008
From Smashing Magazine
Rule #1: Separate Javascript Functionality
Bad markup:
Never include Javascript events as inline attributes. This practice should be completely wiped from your mind.
- <a onclick=“doSomething()” href=“#”>Click!</a>
Good markup:
All Javascript behaviours should be included in external script files and linked to the document with a
- <a href=“backuplink.html” class=“doSomething”>Click!</a>
And the Javascript inside the myscript.js file would contain something like this:


