JQ的安装使用

一 概念


#### 1、版本

- 开发(development)版本:jQuery-x.x.x.js
- 生产(production)版本:jQuery-x.x.x.min.js

#### 2、安装jQuery-3.3.1

[官网下载](https://jquery.com/download/)

```html
<script src="js/jquery-3.3.1.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script>
	// user code
</script>
```

[CDN](https://www.bootcdn.cn/jquery/)

```html
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script>
	// user code
</script>

二 代码示范

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>JQ安装使用</title>
</head>
<body>
jQuery
</body>
<!-- <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script> -->
<script src="js/jquery-3.3.1.js"></script>
<script type="text/javascript">
console.log(jQuery);
console.log($);
console.log(window.jQuery);
// $ === jQuery

// 当使用jq时,jq符号$与其他框架或插件符号发生冲突,可以通过jQuery.noConflict()修改jq符号
var __$ = jQuery.noConflict();
console.log(__$);

</script>

</html>

 

posted @ 2018-10-23 15:45  不沉之月  阅读(973)  评论(0)    收藏  举报