I have one simple Mathjax code:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script>
var ok = function ()
{
document.getElementById('demo').innerHTML="$$10\\x^2$$"
}
</script>
</head>
<body>
<button onclick="ok()">Click</button>
<p id="demo1">Within html $$10\\x^2$$</p>
<p id="demo"></p>
</body>
</html>
Thank you.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script>
var ok = function ()
{
document.getElementById('demo').innerHTML="$$10\\x^2$$"
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
}
</script>
</head>
<body>
<button onclick="ok()">Click</button>
<p id="demo1">Within html $$10\\x^2$$</p>
<p id="demo"></p>
</body>
</html>
The result is not exactly the same :/ But your problem is MathJax doesn't refresh when you change data dynamically.
Maybe take a look here : https://github.com/mathjax/MathJax/blob/master/test/sample-dynamic.html
I don't know this lib, can't help you more.