jQuery Is there a way to wait for object to load before continuing? -
i have problem relating cookies. have group of buttons display specific table related button pushed. have setup assign cookie values , i'm trying remember last viewed users don't have reselect every time close page.
if($.cookie('lastviewed') == "value") { $('#button1').trigger('click'); $('#button2').trigger('click'); }
button 1 loads in button 2, above doesn't work because trying trigger doesn't exist yet.
is there way make wait load before continuing?
edit: using document.ready. clicking button 1 loads button 2 onto page, need wait finish loading in button 2 before tries click it.
you might wanna try too:
$(document).ready(function () { if ($.cookie('lastviewed') == "value") { settimeout(function () { $('#button1').trigger('click'); $('#button2').trigger('click'); }, 100); } });
after delay of 100ms, cause click event after $(document).ready() handlers have been called.
Comments
Post a Comment