How to Use jQuery: An Introduction to the JavaScript Libraryโ€‚by@nimaowji

How to Use jQuery: An Introduction to the JavaScript Library

Nima Owji Hacker Noon profile picture

Nima Owji

a Full-Stack web developer using C#, js, win forms

jQuery is a JavaScript library that is used on your websites. jQuery is open source material that is used to make Javascript programming easier and more efficient.

How to Add jQuery to Your Project

You can download jQuery fromยย or you can use a CDN (Content Delivery Network). There are many CDNs for jQuery.

After that, you should reference it to your HTML page (Like CSS but a bit different).

As you know you can write your codes in "script" tags. You can also use the src attribute of script tags for referencing a js file.

Here is an example:

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

You should assign your jQuery path to the src attribute. For example, my jQuery is in root and I can simply write the name of the file.

How to Use jQuery

You should write your scripts after referencing jQuery because if you write your codes before it, they won't work.

You can simply write your codes in another .js file or in script tags.

It would look like this:

<script src="jquery-3.5.1.min.js"></script>
   //Your JQuery Codes

How to Write jQuery Codes

jQuery codes are easy to write. The first step is to call jQuery. For this, you should use a "$" at the beginning of your codes.

After "$", you should select one or many elements. For this, you can use CSS query selectors.

It may look something like this:


After that, you can modify your elements with jQuery methods. They are many elements available that you can search for in other documentations.

For example, this code will hide an element with "el1" id!


jQuery Codes

jQuery codes look like this:


Thanks for reading

Thanks for reading. My name is Nima Owji. I am a 14 years old programmer. If you had any questions, you can ask me on Twitter! Thank you, have a nice time!

Also published at


Join Hacker Noon

Create your free account to unlock your custom reading experience.