I experienced with JQuery and new to YUI.
I'm looking for YUI's equivalent of the JQuery "$(document).ready".
I found "onDOMReady". If I have a .JS document with a large number of functions, what is the right way to wrap them all in "onDOMReady"?
I experienced with JQuery and new to YUI.
I'm looking for YUI's equivalent of the JQuery "$(document).ready".
I found "onDOMReady". If I have a .JS document with a large number of functions, what is the right way to wrap them all in "onDOMReady"?
YAHOO.util.Event.onDOMReady(function(){
YAHOO.myModule.init();
YAHOO.myOtherModule.init();
});
I usually do something like the above. Otherwise you can do things like the following if you just need a specific element to be present
YAHOO.util.Event.onAvailable('required-element', YAHOO.myModule.init);