如何让 jquery 将 iframe 包装在 div 中,例如,如果使用 vimeo 嵌入 iframe,加载时 jquery 将其包装在 div 类中:
<div class="iframe"><iframe src="http://player.vimeo.com/video/23358638?title=0&byline=0&portrait=0" width="500" height="300" frameborder="0"></iframe></div>
最佳答案
使用 jQuery wrap()
功能:
$("iframe").wrap("<div class='iframe'/>");
关于jquery 将 iframe 包裹在 div 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5947544/