click on link should not trigger parental onclick-event

前端 未结 4 1568
长发绾君心
长发绾君心 2021-01-13 17:38

I\'ve got the following code:


      
4条回答
  •  无人共我
    2021-01-13 18:14

    Add a click handler to your link and stop event bubbleing to the parent div. Like this:

    $('#link').click(function(e) {
      e.stopPropagation();
    });
    

提交回复
热议问题