javascript - jquery stops execution after trying to append element -
my function supposed copy insides of element twice, , append them, reason jquery stops executing after first append. not understand why.
$(".testowyul").prepend(function () { var $temp = $(this).children().clone(); var $temp2 = document.createelement("div"); $temp2.append($temp); $temp2.append($(this).children().clone()); return $temp2.children(); });
you calling append on non jquery object @
$temp2.append($temp);
resulting in
object #<htmldivelement> has no method 'append'
update:
you try using
var $temp2 = $("div");
instead of
var $temp2 = document.createelement("div");
see working fiddle here
Comments
Post a Comment