Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 将元素换行到新的div_Jquery - Fatal编程技术网

Jquery 将元素换行到新的div

Jquery 将元素换行到新的div,jquery,Jquery,我有以下代码: var searchInput = '<md-input-container md-theme-watch="true" flex><label for="sampletext1">Champ texte</label><input name="sampletext1" type="text" class="ng-tree-search"&

我有以下代码:

var searchInput = '<md-input-container md-theme-watch="true" flex><label for="sampletext1">Champ texte</label><input name="sampletext1" type="text" class="ng-tree-search"></md-input-container>';
element.before($compile(searchInput)(scope))
    .prev()
    .on('keyup', function (ev) {
        if (to) {
            clearTimeout(to);
        }
        to = setTimeout(function () {
            tree.jstree(true).search(ev.target.value);
        }, 250);
    });
我尝试了以下方法:

var searchInput = '<md-input-container md-theme-watch="true" flex><label for="sampletext1">Champ texte</label><input name="sampletext1" type="text" class="ng-tree-search"></md-input-container>';
var searchForm = element.before($compile(searchInput)(scope))
    .prev()
    .on('keyup', function (ev) {
        if (to) {
            clearTimeout(to);
        }
        to = setTimeout(function () {
            tree.jstree(true).search(ev.target.value);
        }, 250);
    });
searchForm.wrap($compile('<div class="nrh-tree-search-container"></div>')(scope));
var searchInput='Champ texte';
var searchForm=element.before($compile(searchInput)(scope))
.prev()
.on('keyup',功能(ev){
若(至){
清除超时(to);
}
to=设置超时(函数(){
jstree(true).search(ev.target.value);
}, 250);
});
wrap($compile(“”)(scope));
但这不起作用,我在
'
之外得到
元素

我怎样才能解决这个问题

编辑:
演示

您应该这样尝试:

<div class="nrh-tree-search-container">
   <md-input-container md-theme-watch="true" flex><label for="sampletext1">Champ texte</label><input name="sampletext1" type="text" class="ng-tree-search"></md-input-container>
<!-- element should be added here -->
</div>
检查方法:

$('.accordionTrigger p').wrapAll('');
wrapAll()方法将把匹配的所有元素包装到另一个元素中(与.wrap()方法分别包装匹配的元素相比)

$('.accordionTrigger p').wrapAll('<div class="moreInfo"></div>');