jQuery load() keeping previous elements in memory? -


i have element, load...

$("#pending").load("/pages/tipping/add-tips.php?pending=1&tip_comp=1"); 

whenever radio button checked, re-loaded...

$(".comp_id").on("click",function(){     var compid=$(this).val();     $("#pending").load("/pages/tipping/add-tips.php?pending=1&tip_comp="+compid); }); 

inside loaded content inputs, upon clicking link cycle through these inputs...

$("#submit").click(function(){     $("input.stake").each(function(){         alert("test");     }); }); 

however, every time content re-loaded, seems "remember" previous loads. example, there 1 input cycle through, upon loading page first time, 1 alert.

if change input, , submit, 2 alerts, 3 etc etc. despite there being 1 input there whole time.

what's causing this, , what's solution? it's dricving me little crazy.

edit:

so if cycle through inputs outside file, knows there 1. it's when cycle done within loaded content, thinks there more 1.

thanks

.load adds content target element. use .get if want replace it:

$.get("/pages/tipping/add-tips.php?pending=1&tip_comp="+compid, function(data) {      $("#pending").replacewith(data); }); 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

html - href attribute breaking an element -

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -