Category: javascript
what is jquery
Published on 22 Apr 2026
Explanation
jQuery is a fast, lightweight JavaScript
library
that simplifies HTML document manipulation,
event handling,
animations, and AJAX interactions.
Code:
<script src=" https://code.jquery.com/jquery-3.6.0.min.js" ></script>
Explanation
jQuery makes it easier to select and
manipulate HTML elements using a simple
selector
syntax compared to plain JavaScript.
Code:
// jQuery
$("#title").hide();
// JavaScript
document.getElementById("title").
style.display = "none";
Explanation
jQuery simplifies event handling like
clicks, hover
effects, and form submissions with shorter
syntax.
Code:
$(document).ready(function() {
$("button").click(function() {
alert("Button clicked!");
});
});
Explanation
jQuery provides built-in animation methods
for UI
effects such as fade, slide, and toggle.
Code:
$("#box").fadeOut();
Explanation
jQuery simplifies AJAX requests to
communicate with
servers without refreshing the page.
Code:
$.ajax({
url: "data.json",
method: "GET",
success: function(response) {
console.log(response);
}
});
Explanation
jQuery handles cross-browser compatibility
issues automatically, making
development easier across different
browsers.
Code:
// Same jQuery code works across Chrome, Firefox, Edge, etc.
Explanation
Although modern JavaScript has replaced
many jQuery use cases,
it is still used in
legacy projects and quick
DOM manipulation tasks.
Code:
// Example legacy usage
$("p").addClass("highlight");