jQuery:提交选择器未加载
这是我的HTML和jQuery代码。当我点击按钮时,我没有收到来自浏览器的任何响应jQuery:提交选择器未加载,jquery,jquery-selectors,Jquery,Jquery Selectors,这是我的HTML和jQuery代码。当我点击按钮时,我没有收到来自浏览器的任何响应 <html> <head> <title>jQuery Test</title> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/toggle.js"></scr
<html>
<head>
<title>jQuery Test</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/toggle.js"></script>
</head>
<body>
<input type="submit" value="button">
</body>
</html>
我正在关注的在线教程
您应该在回调中参考
$(此)
:
$(':submit').click(function() {
// Act on the event
$(this).attr('value', 'Please wait')
});
无论如何,
是
元素的一部分-您应该绑定表单本身的submit
事件,而不是单个元素
如果您只需要一个按钮,请坚持使用
应该这样做。
$('submit')。attr('Please wait','value')
也不起作用。将其更改为$(this).attr('value','Please wait')
fyi:submit
已被弃用哇,很难保持更新,哈哈。谢谢@wirey。
$(':submit').click(function() {
// Act on the event
$(this).attr('value', 'Please wait')
});
$("input[type='submit']").click(function() {
// Act on the event
$(this).val('Please wait');
});