我在magento环境中工作,其中js创建动态html。现在我想在另一个之前移动一个元素。因为这可能因为html也在加载表单js并且将应用replace吗?我的最终html代码显示为:
<div class="x-tree-node-el folder active-category x-tree-node-collapsed" id="extdd-3"><span class="x-tree-node-indent"><img class="x-tree-icon" src="http://extjs.com/s.gif"></span><img class="x-tree-ec-icon x-tree-elbow-plus" src="http://extjs.com/s.gif" id="ext-gen27"><img unselectable="on" class="x-tree-node-icon" src="http://extjs.com/s.gif" id="ext-gen24"><a tabindex="1" href="#" hidefocus="on" id="ext-gen21"><span unselectable="on" id="extdd-4">Laptops (2)</span></a><input type="checkbox" class="copycate" value="110" name="tree['110']"></div>
我想在锚定之前移动输入typ =“checkobx”。就像我的最终结果一样
<div class="x-tree-node-el folder active-category x-tree-node-collapsed" id="extdd-3"><span class="x-tree-node-indent"><img class="x-tree-icon" src="http://extjs.com/s.gif"></span><img class="x-tree-ec-icon x-tree-elbow-plus" src="http://extjs.com/s.gif" id="ext-gen27"><img unselectable="on" class="x-tree-node-icon" src="http://extjs.com/s.gif" id="ext-gen24">
<input type="checkbox" class="copycate" value="110" name="tree['110']">
<a tabindex="1" href="#" hidefocus="on" id="ext-gen21"><span unselectable="on" id="extdd-4">Laptops (2)</span></a></div>
我尝试使用此代码但不起作用。
<script>
$('.copycate').insert({
before: "<a>",
after: "<img>"
});
</script>