---
title: "What is Unobtrusive JavaScript?"  
description: "What is Unobtrusive JavaScript?"  
author: "Anupam Mishra"  
published: 2016-05-03  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/23012/what-is-unobtrusive-javascript  
category: "javascript"  
tags: ["javascript", "jquery plugins"]  
reading_time: 2 minutes  

---

# What is Unobtrusive JavaScript?

\

**Unobtrusive JavaScript** is a general term that conveys a general philosophy, similar to the term REST (Representational State Transfer). The high-level description is that unobtrusive JavaScript doesn't intermix JavaScript code in your page markup. For example, rather than hooking in via event attributes like onclick and onsubmit, the unobtrusive JavaScript attaches to elements by their ID or class, often based on the presence of other attributes (such as HTML5 data-attributes).It's got semantic meaning and all of it; the tag structure, element attributes and so on should have a precise meaning. Strewing JavaScript gunk across the page to facilitate interaction (I'm looking at you, -doPostBack!) harms the content of the document.

\

## Answers

### Answer by Anupam Mishra

\

**Unobtrusive JavaScript** is a general term that conveys a general philosophy, similar to the term REST (Representational State Transfer). The high-level description is that unobtrusive JavaScript doesn't intermix JavaScript code in your page markup. For example, rather than hooking in via event attributes like onclick and onsubmit, the unobtrusive JavaScript attaches to elements by their ID or class, often based on the presence of other attributes (such as HTML5 data-attributes).It's got semantic meaning and all of it; the tag structure, element attributes and so on should have a precise meaning. Strewing JavaScript gunk across the page to facilitate interaction (I'm looking at you, -doPostBack!) harms the content of the document.

\


---

Original Source: https://www.mindstick.com/interview/23012/what-is-unobtrusive-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
