What is jQuery
jQuery
Is a front-end library, but also a method library
- He encapsulates a series of methods for us to use
- Some of our commonly used methods are in it, we can just use it directly
What can jQuery do
jQuery
The reason why it is easy to use is that many people are willing to use it because several of its advantages are too powerful.
- Quality selectors and filters
- Useful implicit iteration
- Powerful chain programming
- Because of the emergence of these things, many times what we have to do is "solved by one line of code"
jQuery compatibility
- jquery does not need to consider compatibility at all, because the jquery library encapsulates the compatibility of js
- Only when the major version is 1. It can be compatible to ie8 and below
jQuery frequently used websites
jQuery installation tutorial
- Open jQuery official website
- Click on the download page
jQuery release notes
Production version
-Used in the actual website, it has been streamlined and compressed.
Development version
-For testing and development (uncompressed, readable code)
How to use jQuery
Introduction method
- Use the downloaded library file directly
<head>
<script src="./js/jquery-3.5.1.js"></script>
</head>
- Load jQuery from CDN
<head>
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.5.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
Check whether the introduction is successful
alert($)
alert(jQuery)
- Pop up successfully (just a function, not exactly the same):