jQuery不工作在我的HTML页面

jQuery not working on my HTML page

本文关键字:HTML 页面 我的 工作 jQuery      更新时间:2023-09-26

jQuery不能在我的HTML页面上工作。可能是一些代码/语法问题。需要一双好眼睛看看。

<head>
<script src="../common/js/jquery-1.9.0.js"/>
<script>
$(document).ready(function(){
  $("#insert").click(function(){
      alert("ok");
  });
 });
</script>
</head>
<body>
    <input type="submit" id="insert" value="Insert"/>
</body>
</html>

我确定我的文件在那里,但是我的警报没有弹出。请帮助

script不是自关闭标记,您需要在script开始标记的末尾删除正斜杠。

<script src="../common/js/jquery-1.9.0.js"/>

<script src="../common/js/jquery-1.9.0.js"></script>

修改<script src="../common/js/jquery-1.9.0.js"/>

<script src="../common/js/jquery-1.9.0.js"></script>

自闭脚本标签不起作用-你需要这个-

<script src="../common/js/jquery-1.9.0.js"></script>