Unobtrusive JavaScriptEdit

Unobtrusive JavaScript refers to an approach to including JavaScript code within a webpage in a way that does not intermix the logic (the JavaScript code) with the content (the rest of the HTML content). This separation of logic from content shares some characteristics and motivations with the well-established practice of separating presentation (CSS) from content.

The code itself can either be in an external file, or embedded within the page itself, but the distinguishing characteristic is that it is consolidated into a single location rather than littered throughout the DOM. Generally the code will run once the DOM has finished loading, and traverse the DOM (itself unadorned with code) inserting logic and making any modifications necessary along the way.

Links