Introduction to jQuery: a practical guide to get started simply

jquery

If you are getting into web development, you have surely already heard of jQuery. This JavaScript library, created by John Resig in 2006, quickly became essential thanks to its ability to simplify writing native JavaScript. It allows you to easily interact with the DOM (Document Object Model), animate HTML elements, and even handle AJAX requests with simplicity. Let’s discover together how jQuery can make your life as a developer much more enjoyable.

Why use jQuery?

Before the massive arrival of modern frameworks such as React, Vue, or Angular, jQuery largely dominated the market. Its slogan, “Write less, do more“, perfectly illustrates its philosophy: simplifying common JavaScript tasks with a concise and intuitive syntax.

Here is a concrete example to illustrate the simplicity of jQuery. Suppose you want to hide an HTML paragraph by clicking a button. With pure JavaScript, you would write this:

document.getElementById('myButton').addEventListener('click', function() {
  document.getElementById('myParagraph').style.display = 'none';
});

Using jQuery, this operation becomes extremely simple:

$('#myButton').click(function() {
  $('#myParagraph').hide();
});

Here, not only is the code shorter, but it is also much more readable.

Getting started with jQuery

To get started, you first need to include the library in your HTML project. You can easily integrate it via a CDN like this:

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

DOM selection and manipulation

One of jQuery’s great strengths lies in its ability to easily manipulate the DOM. Here’s how to change the text of an element:

$('#title').text('Welcome to my website!');

You can also modify CSS very simply:

$('.important').css('color', 'red');

Event handling

Event handling in jQuery is very intuitive. Here is an example of displaying an alert when a button is clicked:

$('#buttonAlert').on('click', function() {
  alert('Button clicked !');
});

Simplified animations

jQuery greatly simplifies common animations. For example, to progressively show or hide an element, you would use:

$(‘#box’).fadeIn(1000); // Fade in over 1 second
$(‘#box’).fadeOut(500); // Fade out over 0.5 seconds

Loading dynamic content (AJAX)

AJAX requests become very easy to handle. Here is a simple example to load content from another HTML file:

$('#content').load('content.html');

You can also retrieve JSON data from a server:

$.getJSON('datas.json', function(data) {
  console.log(data);
});

Practical exercise: a simple to-do list

To put into practice what we have learned, here is a small interactive to-do list project in just a few lines of code:

HTML:

<input type="text" id="tache" placeholder="New task">
<button id="add">Add</button>
<ul id="list"></ul>

jQuery:

$('#add').click(function() {
  var task = $('#task').val();
  if(task!== ''){
    $('#list').append('<li>' + task + ' <button class="erase">Delete</button></li>');
    $('#task').val('');
  }
});

$(document).on('click', '.erase', function() {
  $(this).parent().remove();
});

This small example clearly shows how jQuery allows you to create a dynamic interface in very little time and with very clear code.

What future for jQuery in 2026?

With the evolution of native JavaScript (ES6+) and modern frameworks, many wonder if jQuery is still relevant today. The answer is nuanced. jQuery remains useful in specific contexts:

  • Simple or quick projects where a full framework would be excessive.
  • Existing sites that already use it extensively.
  • Progressive JavaScript learning.

Moreover, its lightweight nature (especially with the slim version) and its broad compatibility with various browsers continue to make it an interesting option for many developers.

Conclusion

This introduction has allowed you to see how this library drastically simplifies many common JavaScript tasks. Thanks to its simple and intuitive syntax, jQuery is an excellent choice for getting started in web programming, especially for learning to easily interact with the DOM and handle events efficiently.

Even though jQuery is now competing with many other technologies, it remains an excellent solution for quick projects and progressive learning. So don’t hesitate to try it and integrate it into your future projects!

Sudoku Quest


There you go, now you can shine at parties…

Itamde courses

Recent Posts

Recent Comments

Itamde is also an online programming school.

Itamde

Learn what you want, at your own pace

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You may also be interested in…

Artificial intelligence is reshaping every pixel

Artificial intelligence is reshaping every pixel

Just a few years ago, editing a photo meant spending hours working meticulously in Photoshop, mastering layers, masks and curves. In 2026, everything has shifted. AI photo editing tools no longer settle for automatic filters — they understand image content, anticipate...

The 10 Best Free AI Tools for Developers in 2026

The 10 Best Free AI Tools for Developers in 2026

Artificial intelligence is transforming how developers write, test, and deploy code. In 2026, many AI tools are freely accessible, offering capabilities that would have seemed impossible just a few years ago. Whether you're a beginner or experienced developer, these...

CSS colors

CSS colors

CSS colors can be defined in hexadecimal. Hexadecimal uses three components: red, green, and blue. You can define colors in shorthand hexadecimal: for example #DC2 corresponds to #DDCC22. Note that some colors cannot be abbreviated. The goal is to shorten your...

Stay up to date with the latest news and developments

Access restricted content

Discover behind-the-scenes details of our projects, exclusive resources, and the progress of our creations in real time.

Sign up for our newsletter

Receive our news, creative insights, and updates from the studio directly in your inbox.

Follow us

Join our community on social media to follow our daily projects and interact with us.