jQuery: Trap all click events before they happen?

前端 未结 3 885
南旧
南旧 2020-12-16 13:11

On my page I have a lot of various elements which respond to click events. There are times when I need to block all clicks based on some global flag. Is there a way I can ma

3条回答
  •  渐次进展
    2020-12-16 13:43

    Using Inject Javascript :

    view.loadUrl(
                        "javascript:(function() {"
    
    
                                + "document.addEventListener('click', function(e)"
                                + "{"
                                + "e.stopPropagation();"
                                + "}"
                                + ", true);"
    
                                + "})()"
                );
    

提交回复
热议问题