I have a HTML input field like this:
<input id="op" type="text" value="0" />
I want to update the value of this field dynamically with some string containing superscript. It did not work and I tried this.
document.getElementById("op").value="a<sup>3</sup>" //don't work
document.getElementById("op").innerHTML="a<sup>3</sup>" //don't work
How can I get this to work? I could have tried to figure the rest myself but since I am already forced to ask this, I would like to tell what I am planning to do.
var x=3; var y=2;
document.getElementById("op").innerHTML="a<sup> x-y </sup>";
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…