jquery on click event that call a named function

后端 未结 6 629
青春惊慌失措
青春惊慌失措 2020-12-30 12:10

I have a jQuery onClick handler, writed with an anonymous function like that:

$(\"#selector\").on(\"click\" function(){
    // do something
})
<         


        
6条回答
  •  清歌不尽
    2020-12-30 12:46

    You don't need the () for your function here:

    $("#selector").on("click", namedFunction)
    

提交回复
热议问题