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

后端 未结 3 1311
攒了一身酷
攒了一身酷 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:02

    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/

提交回复
热议问题