Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery:提交选择器未加载_Jquery_Jquery Selectors - Fatal编程技术网

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和jQuery代码。当我点击按钮时,我没有收到来自浏览器的任何响应

<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');
});