Unobtrusive JavaScript represents a technique that separates the JavaScript behavioral code from the page's content and presentation. This greatly eases maintainability, but several factors need to be carefully considered and addressed when using this technique:
JavaScript inline
<script>
elements are not used; only<script>
elements withsrc
attributes are used:<script type="text/javascript" src="path/filename.js"></script>.
All the JavaScript code resides in separate JavaScript files.
No use of inline event attributes on HTML elements.
Don't depend on JavaScript; the site must remain usable without JavaScript; don't assume it will be available on every browser, every time.
Test objects before using them. Test objects before using them. Oh, and test objects before using them.
Avoid any cross-browser problems by choosing solid, proven frameworks for DOM manipulation, event handling, animations, and AJAX.
Separate the behavioral layer from the content...