Blogger Information
Blog 30
fans 2
comment 3
visits 20256
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
jquery的引入方式与简写方式——2018年4月2日
jackallen的博客
Original
582 people have browsed it

一、jquery的两种引入方式

1.外部cdn引用

只需要复制cdn地址即可

<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>

2.本地导入

按本地路径导入即可

<script type="text/javascript" src="./js/jquery-3.3.1.js"></script>

二、简化写法

$(document).read(function){

$('li')[1].style.backgroundColor = 'skyblue'

}

等同于 $(function(){

$('li')[1].style.backgroundColor  = 'skyblue'

)}

——对比与原生写法

var li = document.getElementByTageName('li')

li[1].style.backgroundColor = 'skyblue'

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post