Skip to content Skip to sidebar Skip to footer

.remove() Not Working In Ie And Firefox

I'm loading div element through jQuery .load() method like this: $(document).ready(function() { $('.module-wrapper').load('index.php?option=com_k2&view=itemlist&Itemid=

Solution 1:

To ensure that code only runs after the elements have been loaded, you should put it in the callback function passed to load():

$(document).ready(function() {
    $(".module-wrapper").load(
        "index.php?option=com_k2&view=itemlist&Itemid=974 .genericItemList",
        function() {
            $(".module-wrapper .genericItemList:gt(2)").remove();
        }
    );
});

Your class selector may also be wrong, I tried to rectify it in the code above. It looks like you want to match descendants of .module-wrapper that expose the genericItemList class, but your original selector matches the elements that expose both the module-wrapper and genericItemView classes instead.

Solution 2:

change genericItemList to genericItemView

 $(".module-wrapper .genericItemView:gt(2)").remove();

Solution 3:

Solution 4:

Change it $(".module-wrapper.genericItemView:gt(2)").remove(); to $(".module-wrapper .genericItemList:gt(2)").remove();

Solution 5:

add space before .genericItemList

$(".module-wrapper .genericItemList:gt(2)").remove();

Post a Comment for ".remove() Not Working In Ie And Firefox"