我正在查看使用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);