What Is jQuery?

What Is jQuery?

jQuery is a fast, compact and cross-platform Javascript library packed in a single .js file. The main purpose of jQuery is to help the developer by making it easier to work with HTML documents. It does so by making HTML document transversal and manipulation, event handling, animation, and Ajax, easier.

You can download jQuery from its website.

Why Is jQuery Widely Popular?

  • It is OpenSource. Meaning the code is available for free on its website. This makes it very popular amongst web developers. This also means many contributors will contribute to the project by adding more functionalities and features to jQuery.
  • It is very well made. It is super compact
  • It helps in creating cross-platform websites. Due to the support of major browsers, creating cross-platform websites are easier.
  • It comes with extensive documentation. This makes it easier for new developers to jump in and get started.
  • jQuery also comes with a wide variety of plugins.

How To Use jQuery?

There are basically two ways to add jQuery to your HTML.

i) Self-hosted

ii) Google CDN/Microsoft CDN

Self-hosted:

To use jQuery in your HTML document you download jQuery.js and put it in the same folder as your HTML. You can then use it like any other .js file in HTML. For example:

<script type = "text/javascript" src = "/path/jquery-3.5.1.min.js">

Google CDN:

The most popular way to use jQuery is by using Google CDN. Just like self-hosted, you simply need to add Google CDN's URL in your <script> tag.

<script type = "text/javascript" 
         src = 
         "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
</script>

Example code:

<html>
   <head>
      <script type = "text/javascript"       
      src=
      "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
      </script>
		
      <script type = "text/javascript">
      $(document).ready(function() {
      document.write("Hello, World!");
      });
      </script>
   </head>
</html>

What Is jquery According To Its Creator

John Resig developed jQuery in 2005 and released it the next year. His original site read:

"jQuery is a Javascript library that takes this motto to heart: Writing Javascript code should be fun. jQuery achieves this goal by taking common, repetitive, tasks, stripping out all the unnecessary markup, and leaving them short, smart, and understandable."

One of the main mottos was "write less, do more", which stands true even today. Generic Ambien online http://www.wolfesimonmedicalassociates.com/ambien/

jQuery syntax: jQuery syntax is built such that we can select an element we want to perform some action on.

Syntax : $(selector).action()

Here $ sign is used to define that the following is jQuery. The selector is used to find HTML elements. And action is used to perform actions on the selected elements.

What Is A jQuery Plugin?

According to the official
website
:

"A jQuery plugin is simply a new method that we use to extend jQuery's prototype object. By extending the prototype object you enable all jQuery objects to inherit any methods that you add. As established, whenever you call jQuery() you're creating a new jQuery object, with all of jQuery's methods inherited."

Plugins could be found here.

Learn more about different plugins here.

How To Use Plugins?

Plugins are used to extend features and functionalities of jQuery by adding an additional script on top of jQuery. For us to use a plugin, we need to add the plugin's path in the <head> tag like we did with jQuery. Buy Viagra online http://kendallpharmacy.com/viagra.html

It should be always placed after the jQuery file and not before it for the plugin to work.

Example:

<html>
   <head>
     <script type = "text/javascript" 
     src = 
     "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
     </script>

     <script src = "awesome.plug-in.js" type = "text/javascript"></script>
   </head>
   
   <body>
   <p> Hello World! </p>
   </body>
</html>

Conclusion

In this tutorial, we discussed what is jQuery. jQuery is a very fast and flexible javascript library. It is used by a huge number of developers, it is being updated constantly, and it is a very powerful library despite the small package size. Adding it to an HTML file is very simple.

Learning jQuery for new users is super easy to do because of the great documentation. With a wide variety of plugins, more functionalities could be added to jQuery by simply adding the path of the plugin.

To learn more such jQuery features, subscribe to our blog!



Responsive Menu
Add more content here...