Cancel click event in the mouseup event handler

前端 未结 14 2422
梦毁少年i
梦毁少年i 2020-12-09 14:53

Writing some drag&drop code, I\'d like to cancel the click events in my mouseup handler. I figured preventing default should do the trick, but the click event is still f

14条回答
  •  無奈伤痛
    2020-12-09 15:26

    $(document).mouseup(function(event){
    
        event.preventDefault(); // this prevents only a default action but previously assigned listeners will be called
        event.stopImmediatePropagation() // if there are  others listeners which that shouldn't call 
    }
    

提交回复
热议问题