繁体   English   中英

动态生成内容时,jqMath不呈现公式

[英]jqMath does not render a formula when content is generated dynamically

我正在查看使用JavaScript动态生成的HTML。 这是完成的方式

var el = $('body').find('div#my-div.main');
el.html('');
el.append($("<p>If $ax^2+bx+c=0$ with $a≠0$, then:$$x={-b±√{b^2-4ac}}/{2a}$$</p>"));

但是,页面上没有呈现公式。 我看到了p标记中的确切文本。 我确实检查了jqMath脚本和jqMath css的路径,它们都是正确的。

有谁知道为什么会这样以及如何解决?

像这样追加公式后,调用parseMath函数-

        var el = $('body').find('div#my-div.main');
        el.html('');
        el.append("<p>If $ax^2+bx+c=0$ with $a≠0$, then:$$x={-b±√{b^2-4ac}}/{2a}$$</p>");
        jqMath.parseMath(document.body);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM