The task you are trying to perform is documented here, and there is a live example here.
Basically, the method is to use
<div id="preview">\(\)</div>
and then typeset the preview. Once that completes, use the getAllJax()
method to get the empty math element jax. Something like
var jax;
MathJax.Hub.Queue(
["Typeset",MathJax.Hub,"preview"],
function () {jax = MathJax.Hub.getAllJax("preview")[0]}
);
Then use the element jax's Text()
method to change the math that it displays.
function onkeyup(event) {
MathJax.Hub.Queue(["Text",jax,this.value]);
}