gpt4 book ai didi

jquery 在 Internet Explorer 中使用多个选择器

转载 作者:行者123 更新时间:2023-12-01 05:49:40 26 4
gpt4 key购买 nike

我遇到了一个奇怪的情况。我最近更多地研究了 jquery 并更新了一些旧代码。

我没有将 onClick 放在 html 标签内,而是将其更改为

$(document).ready(
function () {
$('#top_menu, :button, .big').on('click',
function () {
window.open($(this).data('link'), '_self', '');
}
);
}
);

并且 IE 没有在鼠标单击时重定向。相反,如果转到地址 http://mylocaladdress/mysubdir/undefined

经过很多挫折和尝试后,我改变了$('#top_menu, :button, .big')$('#top_menu :button, .big') ,它的效果就像一个魅力。

谁能解释一下吗?

最佳答案

:S完全是菜鸟错误。在代码更改期间,由于某种原因,我丢失了菜单表中的 id

    <table cellpadding="0" cellspacing = "0" id="#top_menu">
<tr>
<td><button class="big" style="font-weight: bold;" nowrap data-link="[action]">[name]</button></td>
...
</tr>
</table>

抱歉给您带来麻烦。

实际上有趣的是它在 Chrome 中运行得很好

关于jquery 在 Internet Explorer 中使用多个选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23517238/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com