我想围绕文字hello world
围绕<input type="text">
。 Span
不应该被它包围。围绕文字环绕一个div
<div class="outer">
"hello world"
<span class="inner">Inner</span>
</div>
$('.inner').parent().contents().wrap('<input type="text"/>')
这一个围绕文本和跨度包装输入。我想避免跨度。谁能帮帮我吗。 fiddle
''不允许有孩子。这将导致HTML无效。 – torvin
试试这个http://jsfiddle.net/4osn1uqp/1/ –