jQuery onclick not working in browser Edge

好久不见. 提交于 2019-12-11 14:59:32

问题


View:

<asp:PlaceHolder runat="server" ID="myPlaceHolder">
        <button id="cmdMyButton">ButtonName</button>

jQuery:

$(function () {
        $('body').on('click', "#cmdMyButton", function (e) {
            alert("alertmessage");
        });

        ...

Clicking the button cmdMyButton works in Firefox and Chrome, but does absolutely nothing in Edge. I do not get the alert in Edge.

I have tried everything in this topic Microsoft Edge: onclick event stops working? But nothing worked for me. I am using jQuery 3.3.1


回答1:


Solved by updating jQuery to 3.3.1

Header.asax:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/3.3.1/jquery-ui.min.js" ></script>


来源:https://stackoverflow.com/questions/48766666/jquery-onclick-not-working-in-browser-edge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!