I have two .php page. Both displays a few info buttons, that i toggle with this code:
$(document).on("click", ".glyphicon-info-sign", function(){
$(".glyphicon-info-sign").not(this).popover("hide");
$(this).popover("toggle");
});
The script is placed after the html elements. I use a div, that contains a page under my header(home, contact, login etc.) and i use jquery-ajax to load the different pages to this div.
The problem is, when i load ,,page 1", then load "page 2", seems like both of the pages onclick event is still being active. I did think if i remove the event listener script from the div, then the listener stops working.
(There's a chance i'm wrong and the problem is something else.)
How can i fix it?