How to disable the onclick event once it happens?

前端 未结 4 994
失恋的感觉
失恋的感觉 2020-12-16 20:55

I had a image which calls add_cart() JavaScript function when onclick()


<         


        
4条回答
  •  攒了一身酷
    2020-12-16 21:35

    If you are dealing this on jquery side,you can use jquery one method

    $(".myDiv").one("click", function(){  
        alert("this will happen only once");  
    });
    

    Cheers

提交回复
热议问题