What is GOOGLE MY BUSINESS
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.
HTML files were saturated, and if the goal was to change the style of 100 pages, it was manually done for each page. This scenario played out as the worst nightmare for web developers. Then along came CSS. It allowed managing web pages style from one place. A similar sort played out for JavaScript.
JavaScript became popular by following in the footsteps of CSS. It was very easy to use and provided a much better user experience.
By mid-2000s several pieces of silver code from JavaScript library had been released. Some of those are MOTOOLS, PROTOTYPE, DOJO, jQuery among many others.
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?
Yes, you read it right. Write less, do more. JQuery is a fast, small, and feature-rich JavaScript library. It’s no surprise that even today jQuery is the most popular lightweight library on the web. It uses the functionality of JavaScript to make it easy for a web developer to do necessary tasks. These tasks may include:
- Manipulating web pages.
- Responding to user events.
- Getting data from web servers.
- Building animations and special effects.
JQuery builds on top of the functionality that a browser gives us via JavaScript DOM API. It simplifies HTML DOM (Document Object Module) tree traversal. With jQuery traversing, you can start from any element and move up, down, and sideways in the DOM tree. In short, it will perform a function in far fewer lines of code than earlier possible.
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.
DIFFERENCE BETWEEN jQUERY AND JAVASCRIPT
Javascript is a programming language. While jQuery is a set collection of functions written using Javascript.
WHAT IS JQUERY USED FOR AND WHY?
jQuery provides a set of functions written in Javascript. The effort has already been put in once. There is no need to re-write these functions. With jQuery, you just use them where you want to. No need to re-invent the wheel. There are tons of libraries out there you can use for your convenience.
jQuery has several benefits over raw JavaScript.
JQuery is cross-browser applicable.
Its a lot easier to use than raw Javascript with less coding.
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
- $(handler)
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
You can download both versions from the jQuery website. The jQuery library is a single javascript file. you can reference it with HTML <scrip>
Note : <script> tag should be inside the tag <head>
<head>
<script src=”jquery-3.5.1.min.js”></script>
</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.
<head>
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js“>
</script>
</head>
Copy and paste the HTML snippet for the library (shown above) for your web page.