Review: DOM access with jQuery
$("h1"); // selects all the h1s $("#heading"); // selects the element with id of "heading" $(".warning"); // selects all the elements with class name of "warning"
jQuery, so those are the same as:
jQuery("h1"); jQuery("#heading"); jQuery(".warning");
$because it's so short.
text()to get the inner content, by passing it 0 parameters:
var heading = $("#heading").text();
$function uses methods like
getAttribute()method. When you use the
$function, you get to use those functions in fewer lines of code, and also know that your code will work in all of jQuery's supported browsers, which is especially important when using the more recent DOM API functions.