attr 在 Chrome 和 safari 中不起作用
我已使用以下调用函数将 onclick 插入到所有内容中: onclick="javascript:loadcontent($(this).attr('rel'));
此代码在 Firefox 和 IE 中正常工作,但在 Chrome 中无效
我该如何修复它?
I've insert onclick to all with below call function :onclick="javascript:loadcontent($(this).attr('rel'));
this code working corectly in Firefox and IE but not in Chrome
How can I fix it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
javascript:
。这是没有必要的。attr()
方法。这里没有任何好处。onclick="loadcontent(this.rel)";
也就是说,这些都是优化。没有明显的原因说明该代码在大多数浏览器中不起作用。检查浏览器的控制台是否有错误。
javascript:
. It's unnecessary.attr()
method. There's no benefit to it here.onclick="loadcontent(this.rel)";
That said, these are both optimizations. There's no obvious reason why that code wouldn't work in most browsers. Check the browser's console for errors.