How to use one click event handler for multiple buttons

后端 未结 4 951
名媛妹妹
名媛妹妹 2020-12-10 08:37

I have 4 buttons with different id\'s. When i click on them i need to perform one function. So i need something like this:

$(\'#button #button\').click(funct         


        
4条回答
  •  醉酒成梦
    2020-12-10 09:18

    Separate each id with a comma:

    $('#button1, #button2, #button3, #button4').click(...)
    

提交回复
热议问题