认识jQuery

2019-12-12  本文已影响0人  Dxes

1.什么是jQuery
jQuery本质就是一个用js封装的库,里面封装了很多方法和对象让网页开发更简单
jQuery是通过jQuery对象来提供功能

2.怎么导入jQuery
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>

3.怎么使用jQuery
1) 在jQuery中$可以看成是jQuery类, $()就是jQuery对象;
2) 可以通过: $(节点) - 将js中的节点转换成jQuery对象;
3) jQuery对象的本质就是容器型数据类型的数据,容器中的元素是节点; 
   直接操作jQuery对象会作用于这个对象中所有节点对应的元素

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <!--2.导入jQuery-->
        <!--导入本地jQuery对应的js文件-->
        <script type="text/javascript" src="js/jquery.min.js"></script>
        
        <!--导入远程的jQuery对应的js文件-->
        <!--<script type="text/javascript" src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
        </script>-->
        
        
    </head>
    <body>
    </body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读