Dynamic added elements double effect after page transition
Posted
by
Emil Moe
on Stack Overflow
See other posts from Stack Overflow
or by Emil Moe
Published on 2013-10-30T15:39:45Z
Indexed on
2013/10/30
15:54 UTC
Read the original article
Hit count: 174
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?
© Stack Overflow or respective owner