Create a Superscript Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Superscript


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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create a SUP element with some text</button>

function myFunction() {//from  w  w  w. ja  v a2s.c om
    var x = document.createElement("SUP");
    var t = document.createTextNode("This text contains superscript text");


Related Tutorials