I have a main div called #Content and I replace a data in the #Content based the menu item clicked:
here is the code:
$('.nav-button').on('click', function(e){
e.preventDefault();
$('#content').load($(this).attr('href'));
});
I have a main div called #Content and I replace a data in the #Content based the menu item clicked:
here is the code:
$('.nav-button').on('click', function(e){
e.preventDefault();
$('#content').load($(this).attr('href'));
});
You're running this binding statement every time you click "Transport":
$(".tsave").live('click',function() {
Try changing it to this:
$(".tsave").unbind('click');
$(".tsave").live('click',function() {
jQuery will append binding statements every time you call them - so, if you bind a click event 10 times to one object, it will run that event 10 times on the event.
Also change this:
$(".save").live('click',function() {
To:
$(".save").unbind('click');
$(".save").live('click',function() {
Found answer here:http://forum.jquery.com/topic/jquery-load-loading-a-javascript-in-to-div-calls-a-function-multiple-times
just made a check not to load the script if it is loaded previously. using this simple script:
if (! window.loadedThisScript){
window.loadedThisScript = true
// the whole part of the script that you only want to load one time.
}
credit to: http://forum.jquery.com/user/jakecigar