Whenever we use $()
or jQuery()
to target an element, a jQuery object is created
$('p')
creates a jQuery object that targets all <p>
elements on a pagejQuery objects can be stored in variables in the same way we are already familiar with
$
to the name of any variable that holds a jQuery Object: // store jQuery object into a variable named "$mainMenu"
$mainMenu = $('#main-menu')
// call a jQuery methods `.hide()` on jQuery object to hide the targeted element
$mainMenu.hide()