jQuery keyUp 从不触发
jQuery keyUp never fires
简单代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
$("#target").keyup(function() {
alert("Handler for .keyup() called.");
});
</script>
</head>
<body>
<form>
<input id="target" type="text">
</form>
</body>
</html>
我可以在输入字段中输入,但没有显示任何提示。我也在 Chrome 和 Mozilla 中尝试过。
文档加载完成后需要运行 keyup 函数
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#target").keyup(function() {
alert("Handler for .keyup() called.");
});
});
</script>
</head>
<body>
<form>
<input id="target" type="text">
</form>
</body>
</html>
简单代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
$("#target").keyup(function() {
alert("Handler for .keyup() called.");
});
</script>
</head>
<body>
<form>
<input id="target" type="text">
</form>
</body>
</html>
我可以在输入字段中输入,但没有显示任何提示。我也在 Chrome 和 Mozilla 中尝试过。
文档加载完成后需要运行 keyup 函数
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#target").keyup(function() {
alert("Handler for .keyup() called.");
});
});
</script>
</head>
<body>
<form>
<input id="target" type="text">
</form>
</body>
</html>