How to make my javascript function wait for a html element to render -


there single page application in angularjs. has nested tabs. in inner tab there button on event gets fired.i need trigger click event of button present on inner tab button gets rendered after both tabs rendered. best way wait until tabs render , button available.

i tried using 'while loop'(i.e keep looping until id button undefined) , $timeout(set timeout 2-3 seconds) service both have consequences when there delay in tab render.

please suggest if there exists better approach.

you can jquery: $(document).ready(callbackfn);

or native js:

document.addeventlistener('readystatechange', function onreadystatechange() { if (document.readystate !== "complete") return; callbackfn(); }, false);


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -