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

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

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -