jQuery: $().click(fn) vs. $().bind('click',fn);

前端 未结 7 1774
北荒
北荒 2020-11-28 03:37

When using jQuery to hookup an event handler, is there any difference between using the click method

$().click(fn)

versus using the bind me

7条回答
  •  迷失自我
    2020-11-28 03:58

    I find the .click() is way more logical, but I guess it's how you think of things.

    $('#my_button').click(function() { alert('BOOM!'); });
    

    Seems to be about as dead simple as you get.

提交回复
热议问题