HTML DOM Subscript Object

Subscript Object

The Subscript object represents an HTML <sub> element.

Access a Subscript Object

You can access a <sub> element by using getElementById():


var x = document.getElementById("mySub");
Try it Yourself »

Create a Subscript Object

You can create a <sub> element by using the document.createElement() method:


var x = document.createElement("SUB");
Try it Yourself »

Standard Properties and Events

The Subscript object supports the standard properties and events.

Related Pages

HTML tutorial: HTML Text Formatting Elements

HTML reference: HTML <sub> tag

JavaScript reference: HTML DOM Superscript Object