Code Conquest

  • Home
  • What is Coding?
  • Tutorials
  • Training
  • Reviews
  • Knowledge Center
  • Versus
  • Blog
You are here: Home / What is jQuery?

What is jQuery?

jQuery is a useful framework built for JavaScript. It’s a popular one too, used by 54.7% of the top 10,000 websites in the world.

If you want to build an interactive web app like a game, jQuery is incredibly useful. Its tagline is ‘write less, do more’ and that’s exactly what jQuery allows you to do.

So this article is going to explain everything you need to know to launch into jQuery.

jQuery is a JavaScript Function

jQuery’s not a programming language. It’s a JavaScript function. And a function, if you’ve forgotten, is just a block of code, like this:

function eat(food) {
    alert('Eating '+food);
    return 'yum';
}

jQuery is a JavaScript function, just like that one. Only it’s a lot bigger and and more powerful. You can get an idea of just how big it is by viewing the source code.

So what does this function actually do? It takes a selector as a parameter, and returns an HTML element. The selector is written much the same as you would write a CSS selector. Here’s an example:

var result = jQuery('ul li.list-item');

The function will find the HTML element <li> that exists inside the element <ul> and has the class name list-item, and assign it to the variable result.

Now that’s pretty useless on its own. The real power of jQuery lies in its methods, which are like sub-functions inside the main function.

jQuery Allows You to Easily Manipulate HTML Elements

So once you’ve selected an HTML element(s) using the main jQuery function, you can then manipulate them using its methods.

There are a ton of methods available. Here’s just one example:

$('p').hide();

This finds all the paragraph elements on the page and hides them. Pretty simple, right?

What’s that dollar sign doing there? It’s just a shorthand alternative to having to write out ‘jQuery’ all the time. Most of the time we use the dollar sign.

Go to docs.jquery.com to look at what methods jQuery provides. There are methods for changing text, changing IDs and classes, hiding and showing, checking for events like elements being clicked, even animation.

Set Up jQuery In Your HTML

So by now you’re probably thinking ‘jQuery is pretty handy’. However, there’s one step to take before you can start using jQuery.

Because jQuery’s not actually built into JavaScript, you need to link it up to your HTML before you can use it. You can do this easily with this code:

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

This fetches Google’s copy of jQuery. You can download your own copy if you want, but most people choose to rely on a centralized copy so browsers don’t have to unnecessarily re-download it every time they reach a website that uses jQuery.

Note that this is also a minified version of jQuery, which means the code’s been reduced down to the smallest number of characters possible.

Make sure your HTML link to jQuery come before your script tags, for obvious reasons. Also put both your link to jQuery and your script right down at the bottom of the page, before the closing body tag. This way all the elements have loaded when your script starts to be executed.

Learn More About jQuery

Treehouse has a video series by Andrew Chalkley that walks you through adding interactivity to a website using jQuery. Here’s a taster video:

Learn more about Treehouse…

And of course, there’s the official jQuery website, which is always an excellent resource if you want to look up a property or method.



Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.

Popular Series

  • What is Coding?
  • How to Make Your First Website
  • Understanding Hex Color Codes
  • How to Become a Coder in 6 Months: a Step-by-Step Action Plan
  • How to Start a Coding Project

Get Our Newsletter

Enter your email address and we'll notify you whenever we add something new to the site.

Popular Blog Posts

  • The 50 Best Websites to Learn Python
  • The 50 Best Websites to Learn JavaScript
  • The 50 Best Websites to Learn PHP
  • Want to Switch Careers? Coding May Be the Perfect Solution!
  • 9 of the Hottest Tech Skills Hiring Managers Look for on LinkedIn

Latest Blog Posts

  • Effective Strategies For Debugging Code
  • Effective Time Management Tips for Programmers
  • Code Documentation: Tools and Techniques
  • Is Data Analytics Hard to Learn?
  • Comparing Data Science vs Computer Science

Explore Code Conquest

  • What is Coding?
  • Free Code Tutorials
  • Coding Training Recommendations
  • Coding Training Reviews
  • Knowledge Center
  • Cheat Sheets
  • Coding Quizzes
  • Versus

Deals, Discounts and Coupons

Deals

Code Conquest

  • Home
  • About
  • Privacy Policy
  • Contact Us
  • Terms of Use
  • Write for Us
  • Featured Review

Copyright © 2025 Code Conquest · About · Terms · Privacy · Contact Us · Write For Us