Get Subscript Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Subscript


The Subscript object represents an HTML <sub> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<sub id="mySub">this subscript text</sub>

<button onclick="myFunction()">set the color</button>

function myFunction() {//from www  .j  ava2s .  c o  m
    var x = document.getElementById("mySub"); = "red";


Related Tutorials