Re:Don't wait for "DOM ready" for your app to start
by spicyj on Friday June 08, 2012 @07:13PM
(#4086571)
Is there a way to achieve the same effect while keeping scripts in the <head>? (Not saying that's the best idea, just wondering.)
[ Parent
| on HN ]
Re:Don't wait for "DOM ready" for your app to start
by crazygringo on Friday June 08, 2012 @07:25PM
(#4086608)
You could have your scripts just define functions, then call all those functions from the bottom of your <body>.
Or, using jQuery, you could probably define a custom event on the <body>, that you trigger manually from the bottom of your <body>, and have your scripts in the <head> listen for that event. I've never actually tried this, though.
Re:Don't wait for "DOM ready" for your app to start
by carey on Friday June 08, 2012 @07:26PM
(#4086615)
YUI can poll for elements to become available, with a few workarounds for browser bugs; see http://yuilibrary.com/yui/docs/event/domready.html. I think you have to roll your own in jQuery.