jQuery is an open source JavaScript Library created by John Resig in 2006.
jQuery simplifies the interactions between DOM and js. Make cross-browser JavaScript development more easily.
In the past development, you have to deal with special case of different browsers. When you using jQuery, everything is consistent.
It will help you coding easily.
There are two ways to use jQuery on your web page:
<head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> </head>
compressed
and uncompressed
compressed
is for production environment and it has smaller size.uncompressed
is source code version and human-readable.the download file name may be like this:jquery-3.4.1.min.js ,put it to your website folder.
Then include it in your HTML file.
<head> <script src="/path/to/jquery.min.js"></script> </head>
Every code should be running after the document is finished loading. So, jQuery provides a function to ensure that.You should put all your code in this function:
$(document).ready(function() { // your code }); //Which is equivalent to the recommended way of calling: $(function(){ });
all methods have the same syntax:
$('selector').methodName()
$
is equivalent to jQuery
'selector'
is used to choose elements in DOM.It can be various expressions. See Selectors
section.
methodName
is the action which will deal with the prior selected element. See Filter
,Utilities
,Effects
etc sections.