jQuery Syntax & Selectors
The basic syntax is: $(selector).action()
// Ensure DOM is fully loaded before running script
$(document).ready(function() {
// Hide all paragraphs when clicking a button
$("button").click(function() {
$("p.alert").hide();
});
});
Common Selectors:
$("#header"): Selects single element with ID 'header'.$(".card"): Selects all elements with class 'card'.$("ul li:first-child"): Selects the first list item of every list.