js动态写html
动态将一段html代码写入div,保持div样式<spanclass="fractionnon-leaf"mathquill-command-id="2"><spancl...
动态将一段html代码写入div,保持div样式
<span class="fraction non-leaf" mathquill-command-id="2">
<span class="numerator" mathquill-block-id="4">
<var mathquill-command-id="3">d</var>
</span>
<span class="denominator" mathquill-block-id="6">
<var mathquill-command-id="5">d</var>
<var mathquill-command-id="7">x</var>
</span>
<span style="display:inline-block;width:0"> </span>
</span>
像这样一段代码... 展开
<span class="fraction non-leaf" mathquill-command-id="2">
<span class="numerator" mathquill-block-id="4">
<var mathquill-command-id="3">d</var>
</span>
<span class="denominator" mathquill-block-id="6">
<var mathquill-command-id="5">d</var>
<var mathquill-command-id="7">x</var>
</span>
<span style="display:inline-block;width:0"> </span>
</span>
像这样一段代码... 展开
1个回答
2013-08-20
展开全部
$("<span class='fraction non-leaf' mathquill-command-id='2'>"
+ "<span class='numerator' mathquill-block-id='4'>"
+"<var mathquill-command-id='3'>d</var>"
+"</span>"
+"<span class='denominator' mathquill-block-id='6'>"
+"<var mathquill-command-id='5'>d</var>"
+"<var mathquill-command-id='7'>x</var>"
+"</span>"
+"<span style='display:inline-block;width:0"> </span>
</span>").appendTo("body");
追问
var htmlSourceShow = 'div#html-source-show'
htmlSourceShow.replaceWith($("x"));
这个怎么不能替换
追答
var htmlSourceShow = $("#html-source-show");
htmlSourceShow.replaceWith($("x"));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询