Access event to call preventdefault from custom function originating from onclick attribute of tag

前端 未结 11 2606
粉色の甜心
粉色の甜心 2020-11-28 04:07

I have links like this:

click
c         


        
11条回答
  •  再見小時候
    2020-11-28 04:38

    I think when we use onClick we want to do something different than default. So, for all your links with onClick:

    $("a[onClick]").on("click", function(e) {
      return e.preventDefault();
    });
    

提交回复
热议问题