I have 3 different variations of "append" going on from different demos because I was trying to get anything to work, but none of them appear to be doing anything at all. I know the jQuery works because remove()
on the original element works just fine when I uncomment it out.
Can you tell me what I'm missing here? Can you also tell me which variation I should be using/what the difference is?
Here's where I'm building: Stable Demo
The jQuery (on demo site)
jQuery(document).ready(function($) {
$(".simplefilter").clone().appendTo($(".filtering-wrap")); // doesn't work
$(".simplefilter").clone().append($(".filtering-wrap")); // doesn't work either
$(".simplefilter").clone().appendTo(".filtering-wrap"); // also doesn't work
$(".simplefilter").remove(); // This does work when enabled
});
The Filter Code to Clone (on demo site)
<ul class="simplefilter simplefilter_3985">
<li class="active" data-filter="all">all</li>
<li data-filter="1">Stores</li>
<li data-filter="2">Creative</li>
<li data-filter="3">Amazon</li>
</ul>
The AppendTo Container
<div class="filtering-wrap"></div>
.simplefilter
element? 2) You don't need to 2 document.ready event handlers 3) Your.appendTo(".filtering-wrap")
should work, if everything has been set up correctly 4)remove()
will be removing it immediately after appending, so you may need to comment that lineremove()
to not be affecting the cloned elements just inserted, which would not be the case.