jquery .bind() and/or .ready() not working

后端 未结 3 1313
攒了一身酷
攒了一身酷 2021-01-21 15:47

So I have this code:

var bindAll;
bindAll = function ()
{
    $(\'#somediv\').bind(\'mouseover\', function(){do something});
};

var init;
init = function ()
{
          


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-21 16:25

    just pass init without parenthesis into the ready function. it is being executed immediately in your case and not on document ready:

    $(document).ready(init);
    

提交回复
热议问题