我想添加一个<ul></ul>标记,而不是一个类<div class='box'></div>。我以这种方式使用appendTo()
$('<ul>').appendTo('.box');
但我得到了:
<div class="box"><li>You did not enter your first name</li><ul></ul></div>
当然,我应该得到:
<div class="box"><ul><li>You did not enter your first name</li></ul></div>
发布于 2011-01-09 22:30:15
你要找的是:
$('.box').wrapInner("<ul />");`http://api.jquery.com/wrapInner/
https://stackoverflow.com/questions/4639658
复制相似问题