Let's study jQuery.(write less, do more.)
JQuery is a JavaScript library that makes it very simple to implement very difficult and complicated functions using JavaScript when we have various effects on the web.
The source of JQuery is between<head></head> Don't just use it
, it will be written between <script type="text/javascript"></script> If you are not sure, please see the sauce below. ^^
<!DOCTYPE html> <html> <head> <title>jQuery</title> <script type="text/javascript"> // write here </script> </head> <body> </body> </html>
Let's put the source type of JQuery in the script tag.
<script type="text/javascript"> $(function(){ }); </script>
The source above is the default type.
html combined with basic document types
<!DOCTYPE html> <html> <head> <title>jQuery</title> <script type="text/javascript"> $(function(){ }); </script> </head> <body> </body> </html>
You can write as above.
But just writing a jQuery resource there is not yet ready to work.
To make it easier to express JavaScript, you need to load the changed jQuery library file.
The current version of the JQuery library source that is currently being written is 3.2.0.
The version will increase over time.
We recommend you use the latest version.
The path of the current jQuery library file is https://code.jquery.com/jquery-3.2.0.min.js.
You can find this address by going to the Jquery homepage and downloading it.
You can also copy the source and keep it on your own server.
This source can also be loaded using script tags.
How To Use
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.0.min.js" ></script>
Same as above.
As a whole source
<!DOCTYPE html> <html> <head> <title>jQuery</title> <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.0.min.js" ></script> <script type="text/javascript"> $(function(){ }); </script> </head> <body> </body> </html>
In the next lesson, we will learn about selecting a selector.
If you know css, do not feel any difficulties ^^