MathJax Equation Demo

HTML

<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&amp;dummy=.js"></script>
<script type="text/x-mathjax-config"> MathJax.Hub.Config({   
        tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
			  	TeX: { 	equationNumbers: { autoNumber: "AMS" },
			  			extensions: ["AMSmath.js", "AMSsymbols.js"],
			  	 },
    }); 
</script>


<button id="b">update</button>

<div id="d">
    \begin{equation} 
        F=ma
        \label{eq:one}
    \end{equation}
    
    Reference \eqref{eq:one}
    
    \begin{equation*}E=mc^2\end{equation*}
    
    \begin{equation}
        F=ma
        
    \end{equation}

</div>

<div id="e">
    \begin{equation} 
        a=b
        \label{eq:three}
    \end{equation}
    
    Reference \eqref{eq:three}
    
    \begin{equation*}E=mc^2\end{equation*}
    
    \begin{equation}
        F=ma
        
    \end{equation}

</div>

JavaScript

$(function(){
    $("#b").click(function(){
        $("#d").html("\\begin{equation} \\label{eq:one}F=G\\end{equation}Reference \\eqref{eq:one}\\begin{equation*}E=\\frac{1}{2}mv^2\\end{equation*}\\begin{equation} F=ma\\end{equation}");
        
        MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
        //MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
    });
});