jQuery $(“.class”).click(); - multiple elements, click event once

前端 未结 18 1653
借酒劲吻你
借酒劲吻你 2020-11-29 00:01

I have multiple classes on a page of the same name. I then have a .click() event in my JS. What I want to happen is the click event only happen once, regardless of multiple

18条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 00:41

    I think you add click event five times. Try to count how many times you do this.

    console.log('add click event')
    $(".addproduct").click(function(){ });
    

提交回复
热议问题