jQuery is a JavaScript Library that focuses on simplifying DOM manipulation, AJAX calls, and Event handling.
jQuery uses a format, $(selector).action()
to assign an element(s) to an event. To explain it in detail, $(selector)
will call jQuery to select selector
element(s), and assign it to an event API called .action()
.
$(document).ready(function(){ alert("Hello World!"); $("#blackBox").hide(); });
The above code carries out the same function as the following code:
window.onload = function() { alert("Hello World!"); document.getElementById("blackBox").style.display = "none"; };
Or:
window.addEventListener("load", () => { alert("Hello World!"); document.getElementById("blackBox").style.display = "none"; });
Learn more
General knowledge
- jQuery on Wikipedia
- jQuery Official Website