MathJax in JQuery Dialog

375 views
Skip to first unread message

Dominic Prakash

unread,
May 24, 2012, 4:06:54 AM5/24/12
to mathja...@googlegroups.com

I am just trying to load the "sample-dynamic.html" available in the test directory of mathJax in a simple JQuery Dialog Box. Here I have given full path to the MathJax.js. Is it possible to load MathJax in a JQuery dialog? I have

<script type="text/javascript">
    function openDialog() {
       $("#somediv").load("http://localhost:8080/MathJax/test/sample-dynamic.html").dialog({modal:true});
    }
</script>

   <div id="somediv">Some text to display</div>
   <a href="#" onclick="openDialog();">Dialog</a>

On click I am seeing the dialog with the codes. Not the Math View.

Appreciate any help.

Regards
Dominic

Murray

unread,
May 26, 2012, 4:09:26 AM5/26/12
to mathja...@googlegroups.com
Hi Dominic

You need to tell MathJax to typeset your newly loaded content, within your openDialog function, using 

MathJax.Hub.Queue(["Typeset",MathJax.Hub]);

I use a similar setup. When readers click on the "Answer" links on each of my pages (which creates a DIV on the fly), it calls the above code.


Regards
Murray
Reply all
Reply to author
Forward
0 new messages