I have a problem, I want to add numbers using a 'textbox' to add my formula math, but it won't render it
<p style="text-align:center; font-size:40px;">
`int ax^n dx `
</p>
Input nilai a : <input type="text" id="a" value="10">
Input nilai n : <input type="text" id="n" value="5">
<button onclick="coba()">OK</button>
<div id="tampil"></div>
<script>
function coba(){
var a= document.getElementById("a").value;
var n= document.getElementById("n").value;
var e= "`int"+ a +"x^"+ n + "dx`"
var f= a+n;
document.getElementById("tampil").innerHTML= e;
}
</script>
You need to tell MathJax that new math has been added to the page after you set the
innerHTML
. Do that by addingafter you set the
innerHTML
.See the documentation for more details.