Reputation: 45
I'm using this code:
$(".heading.media").click(function (event) {
$("#cart").toggleClass("active");
$('#cart').load('index.php?route=module/cart #cart > *');
});
But for some reason the .toggleClass("active")
isn't working. It opens but I can't toggle after that.
When I remove $('#cart').load('index.php?route=module/cart #cart > *');
it works just fine.
Why does $('#cart').load('index.php?route=module/cart #cart > *');
cause trouble ?
Upvotes: 0
Views: 61
Reputation: 2480
Try selecting the element by event delegation method and try.
$(document).on('click', '.heading.media', function (event) {
$("#cart").toggleClass("active");
$('#cart').load('index.php?route=module/cart #cart > *');
});
Upvotes: 3