jQuery 的基本语法理解

Original 2018-12-04 23:09:24 198
abstract:经过两节课对jQuery基本了解总结下:.jQuery是对js的封装,通过到jQuery官网下载js库文件到项目录里后直接引入。用jQuery时在<script><>/script>标签内写入。$(document).ready(function(){     //在此处输写jQuery代码; })在输写代码定义变量、选择器前加

经过两节课对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>

jq.png

Correcting teacher:天蓬老师Correction time:2018-12-05 09:19:33
Teacher's summary:jquery 最常用在DOM操作 , 和Ajax操作上, 在后面的章节中,会有详细说明

Release Notes

Popular Entries