How to stop event propagation with inline onclick attribute?

前端 未结 13 2129
情书的邮戳
情书的邮戳 2020-11-21 23:46

Consider the following:

13条回答
  •  旧时难觅i
    2020-11-22 00:36

    I had the same issue - js error box in IE - this works fine in all browsers as far as I can see (event.cancelBubble=true does the job in IE)

    onClick="if(event.stopPropagation){event.stopPropagation();}event.cancelBubble=true;"
    

提交回复
热议问题