前端-jQuery
一、jQuery的定义
可以看做是一个库,也可以把jQuery看作是一个快速、简洁的JavaScript框架。
公式为:$(selector).action()
获取jQuery
方式一:
https://jquery.com/
方式二:
百度搜索cdn jquery,如
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
 
1.1 绑定方法比较:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>入门</title>
1.2 选择器比较
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择器</title>
    <script src="../resouces/js/jquery-3.6.0.js"></script>
</head>
<body>
<p>p标签</p>
<p id="pid">pid</p>
<p class="pclass">pclass</p>
<script>
    
1.3 文档工具网站
https://jquery.cuishifeng.cn/

二、事件
鼠标事件、键盘事件
2.1 当网页元素加载完毕之后,响应事件
网页确定所有网页元素加载完毕之后,才执行脚本:
2.2 jquery绑定事件

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #divMove {
            width: 300px;
            height: 100px;
            border: 2px solid yellowgreen;
        }
    </style>
    <script src="../resouces/js/jquery-3.6.0.js"></script>
</head>
<body>

2.3 jquery操作dom
2.3.1 节点文本操作
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>操作dom</title>
  <script src="../resouces/js/jquery-3.6.0.js"></script>
</head>
<body>
<ul id="test-ul">
    <li class="js">javascript</li>
    <li name="python">python</li>
</ul>
<script>
    $(function(){
        

2.3.2 css操作

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>操作dom</title>
  <script src="../resouces/js/jquery-3.6.0.js"></script>
</head>
<body>
<ul id="test-ul">
    <li class="js">javascript</li>
    <li name="python">python</li>
</ul>
<script>
    $(function(){
        
2.3.3 元素的显示和隐藏
本质上是css的display:none
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>操作dom</title>
  <script src="../resouces/js/jquery-3.6.0.js"></script>
</head>
<body>
<ul id="test-ul">
    <li class="js">javascript</li>
    <li name="python">python</li>
</ul>
<script>
    $(function(){
        
2.3.4 其他测试
$(window).width();
$(window).height();
$("#test-ul li[class=js]").toggle();
 
2.4 ajax
未来ajax提交也用这个
$("#form").ajax()
三、前端小技巧
 
3.1.巩固js
看框架源码,主要是jquery,看游戏源码
3.2 巩固HTML和CSS
扒网页下来,全部down下来
 
3.3 其他前端框架介绍
elementUI
Ant Design