经过两节课对jQuery基本了解总结下:
.jQuery是对js的封装,通过到jQuery官网下载js库文件到项目录里后直接引入。
用jQuery时在<script><>/script>标签内写入。
$(document).ready(function(){ //在此处输写jQuery代码; })
在输写代码定义变量、选择器前加$符;
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript" src="jquery-3.3.1.js"></script> </head> <script type="text/javascript"> $(document).ready(function(){ $str="php中文网"; $("div").hide(); $("button").click(function(){ $("div").show(); }) }) </script> <body> <div style = "width:100px;height:100px;background:#ccc;"></div> <button>点这</button> </body> </html>