Javascript wrapAll不包装纯文本
有些HTML如下所示:Javascript wrapAll不包装纯文本,javascript,jquery,Javascript,Jquery,有些HTML如下所示: <body> Do all declarations for the same <TT>static</TT> function or variable have to include the storage class <TT>static</TT>? </body> 如何修复此问题,使其保留原始结构?子节点不返回文本节点。您需要使用
<body>
Do
all
declarations for
the same
<TT>static</TT> function
or variable
have to include the storage class <TT>static</TT>?
</body>
如何修复此问题,使其保留原始结构?
子节点
不返回文本节点。您需要使用目录
$('body').contents().wrapAll("<div class='container'><div class='row'><div class='col-md-12'></div></div></div>");
$('body').contents().wrapAll(“”);
$(函数(){
$('#children').children().wrapAll(“”);
$('#contents').contents().wrapAll(“”);
});代码>
关于儿童:
做
全部的
声明
相同的
静态函数
或变量
必须包含存储类static吗?
内容包括:
做
全部的
声明
相同的
静态函数
或变量
必须包含存储类static吗?
尝试.contents()
而不是.children().wrapInner()
在这里也适用于您:
$('body').contents().wrapAll("<div class='container'><div class='row'><div class='col-md-12'></div></div></div>");