javascript - jQuery onclick 在浏览器 Edge 中不起作用

标签 javascript jquery webforms onclick microsoft-edge

查看:

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

jQuery:

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

        ...

单击按钮 cmdMyButton 在 Firefox 和 Chrome 中可以工作,但在 Edge 中绝对不会执行任何操作。我在 Edge 中没有收到警报。

我已经尝试了该主题中的所有内容 Microsoft Edge: onclick event stops working? 但对我来说没有任何作用。我正在使用 jQuery 3.3.1

最佳答案

通过将 jQuery 更新到 3.3.1 解决

标题.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>

关于javascript - jQuery onclick 在浏览器 Edge 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48766666/

相关文章:

c# - ASP.NET 4.0 Webforms - 全局错误处理问题

javascript - 移动 br 元素

javascript - For 循环 - 在第一项之后添加一些内容,然后每 2 项之后添加一些内容

javascript - 如何比较路径是否在同一个文件夹中

c# - 重定向到 Jquery 中的 Action-Controller MVC 4

javascript - 删除、替换或禁用动态生成的 ASP.Net js 代码

javascript - document.getElementById(id) 和切换多个 id

javascript - 通过处理程序解除函数绑定(bind)的问题

javascript - Bootstrap-select.js - 选择一个选项后,整个选择消失

dependency-injection - 在 ASP.NET 中使用 Unity.WebForms