div onclick 在 IE 8 和 Chrome 中未触发

发布于 2024-12-10 14:58:05 字数 252 浏览 4 评论 0原文

我的应用程序中有以下 javascript 函数,预计会根据 div 单击执行网格过滤,但我面临的主要问题是 div 单击在 mozilla firefox 中工作正常,但在 IE 8 和 chrome 中则不行,可以任何人都可以帮助解决与此功能相关的问题

$(function(){
    $('#FileDiv').live('click', function (e) {
       alert(1);

    });
});

I have the following javascript function in my application which is expected to perform grid filtering based on the div click, but the major problem i am facing is that the div click is working fine in mozilla firefox , but not in IE 8 and chrome, can anyone help to figure the issue related to this function

$(function(){
    $('#FileDiv').live('click', function (e) {
       alert(1);

    });
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墨洒年华 2024-12-17 14:58:05

需要 HTML 进行验证,但这就是我遇到问题的地方:

  1. 确保 id="FileDiv" 的 div 实际上存在。我看到您正在使用 ASP.NET,并且我花了一些时间调试影响由于服务器端逻辑而未交付的内容的客户端代码。真正的拍额头的东西。
  2. 尝试其他活动。尝试直接单击以查看是否重要,而不是实时。
  3. 确保您的函数在文档加载时被调用。我怀疑不是。

Need the HTML to verify, but here's where I've run into trouble with this:

  1. Make sure a div with id="FileDiv" is actually there. I see you're using ASP.NET and I have spent time debugging client-side code affecting content that was not delivered becuase of server-side logic. Real forehead-smacking stuff.
  2. Try other events. Instead of live, try straight-click to see if that matters.
  3. Make sure your function is being called on document-load. I suspect it isn't.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文