我有一些HTML,其中包含一个post内容:
<div class="post-content">
<iframe width="40" other-properties>
iframe code
</iframe>
Other content and other tags
</div>如何用div包装post内容中的所有iframe标记:
<div class="post-content">
<div class="video">
<iframe width="40" other-properties>
iframe code
</iframe>
Other content and other tags
</div>
</div>发布于 2015-11-30 13:03:12
$(".post-content iframe").wrap('<div class="video"></div>');发布于 2015-11-30 13:04:51
如果需要在浏览器中这样做,可以使用jQuery (参见docs - http://api.jquery.com/wrapinner/):
$(".post-content").wrapInner("<div class='video'></div>")https://stackoverflow.com/questions/33999290
复制相似问题