Dynamic added elements double effect after page transition
- by Emil Moe
I have added dynamic from jQuery in my code, but when I go back one page and return to the page where the 's are added and you press them, they somehow click twice now.
I have tried with an alert('something'); when I click:
$(document).on('click', '#products a', function() {
alert('something');
}
And it's shown twice when you return to the page. I have tried
$('#products a').remove();
When you click the 'Back' button, because I thought all elements where added twice, but that made no difference.
I don't have anything around these lines, maybe I need $(document).ready(); or something with pageinit?