Get Superscript Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Superscript

Introduction

The Superscript object represents an HTML <sup> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<sup id="mySup">this superscript text</sup>

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

<script>
function myFunction() {/*from  w ww .  j a  v a  2  s. c  om*/
    var x = document.getElementById("mySup");
    x.style.color = "red";
}
</script>

</body>
</html>

Related Tutorials