O'Reilly logo

jQuery Essentials by Troy Miles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hiding and showing elements

Let's take a look at animations in jQuery with two of the most useful ones: hide and show. jQuery provides us with the .hide() and .show() methods, which do exactly what their names suggest. Straight out of the box, these two methods don't animate; they act as simple switches, immediately hiding or showing the attached set of elements. However, both of them have several ways it can be called. First, let's take a look at the .hide() method, and then look at its companion, the .show() method.

In its most basic mode, the .hide() method is called with no parameters, as follows:

$(elements).hide();

When called like this, it immediately hides the specified set of elements. Internally, jQuery adds a style attribute to the elements ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required