click on link should not trigger parental onclick-event

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

I\'ve got the following code:


      
4条回答
  •  無奈伤痛
    2021-01-13 18:03

    OnClick event you can pass the current object type. something like

    onclick=foo(this)

    The function foo looks like

     function foo(obj) {    
          if(obj.tagName != 'A') {
           alert('Yes')    
          } 
    }
    

提交回复
热议问题