What is jQuery, Its Use and how does it work, How to implement it in Website?

Emily Heming 12th Jul 2020

jQuery is a lightweight JavaScript library that makes using JavaScript much easier on your website. Have you been planning on using it, but are vaguely aware of it? I'll recommend you to read this post, as it will provide you an insightful look at how resourceful query could be. In addition, you'll gain basic understanding about its basic aspects.

What is jQuery?

jQuery, as of now, is the most popular JavaScript framework that is used for building browser-compatible web pages and applications. It helps to simplify things for rapid web development, such as:

  • HTML document traversal and manipulation,
  • Event handling,
  • Animation,
  • and AJAX interactions.

Wondering, what does that mean to you? In simple words, jQuery help you write browser-compatible JavaScript code using simple syntax. It helps to accomplish plenty of tasks that usually require writing several lines of JavaScript code.

It does so by wrapping those tasks into methods that can be called with just a single line of code. And thus, it save a lot of your time – that you otherwise – would have spend in writing monotonous code and rather can work with adding cool effects right away.

However, before working with jQuery you should obtain basic understanding of JavaScript, HTML and CSS.

Uses of jQuery

So, now that you have a slight of idea of what jQuery is let us talk about its use.

  • JavaScript engines differ on browsers, and so JS code that works well on a browser might not work on the other. This creates cross-browser incompatibilities. Using jQuery you can get rid of the browser compatible issue.
  • Manipulating a web page using jQuery, ensures that the content will be rendered despite the fact JavaScript is disabled in the browser.
  • Web designers often look for plugins that can make their designs good looking. And with the help of some jQuery plugins like Pop-up Boxes, Image Slider, and others help make the Web designer’s job pretty easy. They only need to make tweaks or customize certain parts of the plugins, to match up to their design needs.

How jQuery Works and How It Can Be Implemented?


There are two different ways that makes jQuery work:

1. You can download jQuery library and include it within a JavaScript file as follows:

<script type="text/javascript" src="jQuery-1.4.1-min.js"></script>

2. The second and the preferred way requires you to include jQuery from a CDN (Content Distribution Network). There are two benefits of choosing this option. First off, it ensures that we make use of the recent version of the jQuery library. Secondly it helps to reduce the server load, as this option takes up less bandwidth. In order to include jQuery from CDN (such as Google), you will have to use the following code:

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

</head>

Now, to see how jQuery can be implemented in your website let us consider a simple example:

<html>

<head>

<meta charset="utf-8">

<title>Demo</title>

</head>

<body>

<script src="https://domain_name.com/">jQuery</script>

<script src = "jquery-1.11.2.min.js"></script>

<script>

//You code will come here

</script>

</body>

</html>

As you can see, the latest version of the jQuery library is included in the

Authored By Emily Heming

Also on DiscussDesk