gpt4 book ai didi

javascript - 获取 "change"以在 IE9 中工作

转载 作者:行者123 更新时间:2023-11-28 10:59:44 24 4
gpt4 key购买 nike

我无法让 .change() 在 Internet Explorer 9 中使用输入。它适用于所有其他浏览器(我已经尝试过),但不适用于 IE 9。

<html>

<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
</head>

<body>

<script type="text/javascript">
$(document).ready(function() {
$('.myInput').change(function () {
alert("hi");
});
});
</script>

<input class="myInput" />

</body>

</html>

有什么想法吗?

最佳答案

只需添加适当的属性即可告诉 IE 它是文本框:

<input class="myInput" type="text" />

编辑:虽然指定类型仍然是更好的做法,但这不是问题,它 works fine对我来说,在 IE9 中,就像乔恩问的那样:“不工作”是什么意思?

关于javascript - 获取 "change"以在 IE9 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7384455/

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