$(".yourButtonClass").on('click', function(event){ event.stopPropagation(); event.stopImmediatePropagation(); //(... rest of your JS code) });