How to stop event propagation with inline onclick attribute?

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

Consider the following:

13条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 00:23

    For ASP.NET web pages (not MVC), you can use Sys.UI.DomEvent object as wrapper of native event.

    or, pass event as a parameter to inner function:

    and in someFunction:

    function someFunction(event){
        event.stopPropagation(); // here Sys.UI.DomEvent.stopPropagation() method is used
        // other onclick logic
    }
    

提交回复
热议问题