- 本文出自<svtter.github.io>
在javascript函数外部定义的变量均为全局变量。
调用jQuery, 需要把jQuery放在<script>
最前。
调用本地jQuery的代码
jQuery 目录: ../js/jquery-1.11.1.min.js/
其他的script文件放在jquery后即可
HTML
依据w3cschool修改
<html> <head> <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ alert("debug!") $("button").click(function(){ $("p").hide(); }); }); </script> </head> <body> <h2>This is a heading</h2> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button>Click me</button> </body> </html>