click() event is calling twice in jQuery

Make sure and check that you have not accidentally included your script twice in your HTML page.


Make un unbind before the click;

$("#link_button").unbind('click');
$("#link_button")
.button()
.click(function () {
   $("#attachmentForm").slideToggle("fast");
});

It means your code included the jquery script twice. But try this:

$("#btn").unbind("click").click(function(){

//your code

});

I tried , e.stopImmediatePropagation(); This seems to work for me.


In my case I used the below script to overcome the issue

$('#id').off().on('click',function(){
    //...
});

off() unbinds all the events bind to #id. If you want to unbind only the click event, then use off('click').