Hide and Show jQuery Effects

 Amazing! Hide, Show, Toggle, Slide, Fade, and Animate are all choices.

Illustration:

jQuery hide() shows a basic jQuery hide() method.

jQuery hide() Another example of a hide() function. How and when to Hide Text Sections

The hide() and show() methods in jQuery allow you to hide and show HTML elements:

Illustration:

 

EXAMPLE ❯


Syntax:

$(selector).hide(speed,callback);
$(selector).show(speed,callback);

The additional motion measurement, which can also take the values "slow," "fast," or milliseconds, expresses the hiding/showing motion explicitly.

The optional callback attribute specifies a function that will be executed after the hide() or show() method has completed.

(More on callback functions will be covered in a later chapter.)

In the following description, the motion parameter is illustrated with hide():

Illustration:

EXAMPLE ❯


toggle jQuery ()

The toggle() method could also be used to toggle among attempting to hide and displaying an element.

Elements that seem to be observable are hidden, and vice versa:

Syntax:

$(selector).toggle(speed,callback);

The parameter for entirely voluntary motion can be set to "slow," "fast," or "nanoseconds."

The absolutely legitimate message queue parameter specifies a function that would be executed after toggle() has fulfilled.