$("#" + mainContent).children("span").replaceWith(function(){ return $(this).text(); });
使用上面的代码行我似乎无法代替所有跨度与文本值。jQuery Selctor,DIV内的所有跨度
的HTML看起来像
<div id="bla" contenteditable="true">
<span> bla finds this one</span>
<div>
<span> doesnt find me </span>
</div>
</div>
如何选择专区内“喇嘛”所有的跨度和全部更换?
的更换工作只是找到doenst ..
你得到的参数是错误的,OP想要替换整个元素,而不仅仅是内容。 –
@ Felix - 谢谢,修正。有时我觉得我的整个生活都是倒退的:-) –