On 6/26/09 11:14 AM, "lazytt" <mbre...@gmail.com> wrote: > > Hello. I'm having a problem with the following code: > > $(".prodname").livequery(function(){ $(this).autocomplete > ("search.php", { > extraParams: { 'type':'products' } > }); }); > > $(".prodname").livequery(function(e){ $(this).change(function(e) { > $(".barcode."+thisline(e)).val(''); > $.ajax({ > type: "GET", > url: "agent.php", > data: "prodname="+$(".prodname."+thisline(e)).val() > +"&action=getprodid", > success: function(text){ > $(".prodid."+thisline(e)).val(text); > } > }); > }); }); > > It seems that the change event doesn't auto-bind to new elements.
i wouldn't expect so. adding an element to the dom isn't an onChange event. > If I > use .click() it works fine. If I remove the auto complete it works > fine. And the .change() gets triggered just fine on static elements - > the problem is only on new (ajaxly added)elements. what i do to add a autocomplete to new, ajax-added dom elements is: $(window).ajaxStop(function() { ... code to add autocompletes here ... });