Let’s go back and review the history of front-end development. Many years ago if front-end developers had to do font tags and color attributes they had to set tags.
JQuery became the top choice of developers for site interactivity and user experience.
HTML Relies on structure
CSS Used for site appearance and styling
JQuery Controls the behavior of interactivity
WHAT IS JQUERY?
Manipulating web pages
Responding to user events
Getting data from web servers
Building animations and special effects
We will try to understand by using some examples:
Let’s suppose you wanted to resize all the images on your web page or wanted to add some animation. You could choose to write several lines of code. Or you could write a single line of code and let jQuery do all the heavy lifting for you. jQuery simply means less coding to achieve the same results. Not only that jQuery will also take care of any cross-browser bugs, to make life easier.
WHAT IS JQUERY USED FOR AND WHY?
JQuery is cross-browser applicable
It is extensible (mechanism available to extend the programming language)
It’s simple and has rich AJAX support
jQuery comes with excellent documentation
It has a large developer community and offers many plugins
WHAT IS THE MEANING OF $ IN JQUERY
Here you can find out symbols and their meaning.
Points to Remember
Ready ( ) function ensures that the DOM is fully loaded
$ It is short for jQuery
All three of the following syntaxes are equal to each other:
- $(document) . ready (handler)
- $( ). Ready (handler) this is not recommended
HOW TO GET JQUERY ON A WEBSITE
Here are two ways to add jQuery to your website:
- Download the jQuery library from its site www.jquery.com.
- Include jQuery from Google CDN (Content Delivery Network)
There are 2 versions available for downloading jQuery.
- Production version – Used for the live website. The code is minified and compressed.
- Development version – Used for development and testing. Code is readable and uncompressed
Note : <script> tag should be inside the tag <head>
But if you don’t want to download and host jQuery, you can include it from a CDN (Content Delivery Network). Google hosts jQuery, which goes by the name of jQuery Google CDN.
Google CDN is the most reliable, fast, and globally available content delivery network. jQuery hosted on Google CDN is a great choice. This is because Google works directly with all key stakeholders involved. It updates libraries to the most current version with ease and convenience. Google recommends that libraries are loaded from CDN via HTTPS. This is applicable even if your website uses only HTTP.
Copy and paste the HTML snippet for the library (shown above) for your web page.