Selectors are a core piece of the jQuery library. jQuery code follows this basic methodology:
Select an element.
Do something with it.
As we mentioned above, the
$() is the method that you use to select elements. For
$(document).ready(), we’re actually selecting the “document” and defining what to do when the
ready() event fires.
You can select any element (or multiple elements) on your page. Following are three basic ways of selecting elements:
Matches a single element with the element ID. The ID you provide should be prefaced by a
# character. For example,
$("#myId") would match
By CSS Class—
Matches all elements with the provides CSS class. The class you provide should be prefaced with a
. character. ...