What is jQuery?
jQuery is a fast, small, feature-rich JavaScript library that simplifies HTML manipulation, event handling, animation, and AJAX with an easy-to-use API across browsers.
Why jQuery?
- Write less, do more
- Cross-browser compatible
- Huge ecosystem of plugins
- Still widely used in legacy projects
Adding jQuery
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>Document Ready
$(document).ready(function() {
console.log("DOM is ready");
});
// Shorthand
$(function() {
console.log("Also ready");
});First Example
$(function() {
$("button").click(function() {
$("p").text("Hello jQuery!");
});
});