i have some problem with my jquery. I need to remove first two elements from some list after specify div loads. When document is ready I didn’t have this div in my DOM, it’s appending after some click action. So, what i need to do is make function which this specify div will be adding to my DOM. This is my code, thx for help.
setTimeout(function(){
if ($('.sv_flex_slider .slides').find('li').size() > 3) {
$('#fancybox-thumbs').load(function(){
setTimeout(function(){
$('#fancybox-thumbs ul').find('li').eq(1).remove();
$('#fancybox-thumbs ul').find('li').eq(2).remove();
},200);
})
}
},200);
You need a trigger when the div is created. Like this:
Then you can listen to that: