MathJax - How to refresh LaTex format after a button click
<p>I'm having some issues with the using of MathJax updating after the page refresh.</p>

<p>In particoular, I've created a HTML doc with a LaTex formula "$$ \int \sin (x) = $$" and a button. The button add a new LaTex formula ("$$\int \cos(x) $$") at the bottom of the page.
When I run the page the first formula is correctly shown in LaTex format. But when I click the button, the first one is still correctly shown while the new one is not, even though I insert the call of MathJax.Hub.Queue(["Typeset",MathJax.Hub]) method.</p>

<p>I attach HTML, button javascript code and output.
HTML:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function btt(){ 
    $("#div2").append("$$\int \cos(x) $$");
        MathJax.Hub.Queue(["Typeset",MathJax.Hub]) 
    };</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"
    src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"&gt;
    &lt;/script&gt;
   

    &lt;div id="div1"&gt; $$ \int \sin (x) = $$
    &lt;button id= "btt" onclick= "btt()" name="a";&gt; click! &lt;/button&gt;
    &lt;/div&gt;

    &lt;div id="div2" class="container"&gt;  &lt;/div&gt;</code></pre>
</div>
</div>

<a href="https://i.stack.imgur.com/C9aqH.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/C9aqH.jpg" alt="enter image description here"></a></p>

<p>How can I show the second formula with a LaTex format?
Thanks a lot.</p>