jQuery Tutorial Tutorials - jQuery Introduce

jQuery Introduce

What is jQuery?

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.

Using jQuery on HTML

There are two ways to use jQuery on your web page:

  1. use CDN.
    there are many providers who provide the jQeury Content Delivery.
    Example using jQuery library from CDN:
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
  1. Local Installation
    Go to the official website:https://jquery.com/download/
    and download the latest version jquery.
    There are two type: 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>

How to use jQuery function(method)

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.

Try now

Date:2019-06-08 18:45:15 From:www.Lautturi.com author:Lautturi