So I have this code:
var bindAll;
bindAll = function ()
{
$('#somediv').bind('mouseover', function(){do something});
};
var init;
init = function ()
{
bindAll();
...
};
$(document).ready(init());
and it does not work. But if I put the bind on a timer by replacing:
bindAll();
with
tt = setTimeout('bindAll()', 1000);
It suddenly works perfectly. What!??
jQuery ready expects a handler, not a function call.
// $(document).ready(init()); <-- Not working
$(document).ready(init); <-- Working!
Working example at: http://jsfiddle.net/marcosfromero/Qwghb/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With