[英]jquery stops execution after trying to append element
我的函数应该复制两次元素内部,然后追加它们,但是由于某种原因,jQuery在第一次追加之后停止执行。 我不理解为什么。
$(".testowyUl").prepend(function () {
var $temp = $(this).children().clone();
var $temp2 = document.createElement("div");
$temp2.append($temp);
$temp2.append($(this).children().clone());
return $temp2.children();
});
尝试:
var $temp2 = $("<div>");
代替:
var $temp2 = document.createElement("div");
创建一个jQuery对象。 由于DOM元素中没有“附加”方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.