jQuery Dom 操作:使用 jQuery 在 div 周围添加包装器 div
jQuery Dom Manipulation : Adding wrapper div around a div using jQuery
when I'm designing a website I came across this issue . I had to
create a wrapper DIV around a DIV in my html code. So I'm asking this
Question because this will be useful to others in future
我不想使用 jQuery
向 div 添加包装器 div
<div class="innerdiv"></div>
jQuery为您提供方法:
$('.innerdiv').wrap('<div class="outerdiv"></div>');
这可能已被询问和回答,但这是我的回复:
其次,这是简单的答案:
$( ".innerdiv" ).wrap( "<div class='new'></div>" );
您可以使用 jQuery .wrap()
用另一个 div 包装一个 div
<div class="innerdiv"></div>
在 jQuery 代码中,你必须 select 内部 div 然后你必须创建包装器 div 插入 wrap( )。你需要将 jQuery 导入到 运行 this.
$( ".innerdiv" ).wrap( "<div class='new'></div>" );
when I'm designing a website I came across this issue . I had to create a wrapper DIV around a DIV in my html code. So I'm asking this Question because this will be useful to others in future
我不想使用 jQuery
向 div 添加包装器 div<div class="innerdiv"></div>
jQuery为您提供方法:
$('.innerdiv').wrap('<div class="outerdiv"></div>');
这可能已被询问和回答,但这是我的回复:
其次,这是简单的答案:
$( ".innerdiv" ).wrap( "<div class='new'></div>" );
您可以使用 jQuery .wrap()
用另一个 div 包装一个 div<div class="innerdiv"></div>
在 jQuery 代码中,你必须 select 内部 div 然后你必须创建包装器 div 插入 wrap( )。你需要将 jQuery 导入到 运行 this.
$( ".innerdiv" ).wrap( "<div class='new'></div>" );