HTML Attributes in the DOM

By: Dusty Arlia
Published on Tuesday, July 30, 2013, 05:41 AM
Last Updated on Friday, July 10, 2015 at 11:27 PM
Total Updates: 2

Every HTML attribute has an attribute node in the DOM tree. Two of the most popular HTML attributes to work with are the id and class attributes. Using the id attribute, you can uniquely identify and access an individual HTML element. There should only be one element with a certain id value on a single HTML page. With the class attribute, you can identify and access a group of HTML elements. Multiple elements can share the same class value. Here is an example:

<h1 id="article_title">Example Page</h1>
<p class="article_body">Paragraph 1</p>
<p class="article_body">Paragraph 2</p>

Comments:

Ad: