javascript - Chrome only updates with jquery.html() when debugging and hitting breakpoint -



javascript - Chrome only updates with jquery.html() when debugging and hitting breakpoint -

i've got next snippet in web page. it's suppose temporarily alter inner html content of container, when user clicks "buy" button on page.

////////// // add together items basket // //////// function addtobasket(pageid, itemid, produktnumber, domelem) { var temphtml = $(domelem).html(); $(domelem).html('<i class="fa fa-refresh fa-spin"></i>'); $(domelem).attr('disabled', true); // update cart updatecart('/default.aspx?id=' + pageid + '&amp;productid=' + itemid + '&amp;quantity=' + $('#antal_' + produktnumber).val() + '&amp;cartcmd=add', undefined, false, domelem); $(domelem).html(temphtml); $(domelem).removeattr('disabled'); }

the sec line in function triggered in chrome when i'm debuging... out has seen simular problem?

it's works great in ie , ff - i'm confused right now...

** edited **

okay... i've edited script according advice i've been given - problem remains :( actualy thought ajaxcomplete should prepare it, doesn't... workingelement.html(''); seems skipped when running without breakpoints.. , in chrome...

function addtobasket(pageid, itemid, produktnumber, domelem) { var temphtml = $(domelem).html(); var workingelement = $(domelem); workingelement.html('<i class="fa fa-refresh fa-spin"></i>'); workingelement.attr('disabled', true); $(document).ajaxcomplete(function(){ workingelement.html(temphtml); workingelement.removeattr('disabled'); }); // update cart updatecart('/default.aspx?id=' + pageid + '&amp;productid=' + itemid + '&amp;quantity=' + $('#antal_' + produktnumber).val() + '&amp;cartcmd=add', undefined, false, domelem); }

you need instantiate jquery in function if not wrapped already:

function addtobasket(pageid, itemid, produktnumber, domelem) { $(function() { // code here }); }

javascript jquery html google-chrome

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -