jQuery: hide() Function

By: Dusty Arlia
Published on Monday, July 22, 2013, 08:01 PM
Last Updated on Friday, July 10, 2015 at 2:39 PM
Total Updates: 3

The jQuery hide() function will hide the matched elements. There are various effects that you can pass to the function, as arguments, that defines how the element should hide. Here is the basic syntax for this function

.hide([duration], [easing], [complete])

The arguments you pass to this function are optional. This function would work fine with no arguments at all. Here is an example:


This hides the element using the hide() function's default arguments.

Here is a table of the hide() function's parameters and default arguments for jQuery version 1.4.3:

Parameter Default Argument Argument Type Description
duration 400 Number or String A number or string that determines for how many milliseconds long the animation will run (1,000 milliseconds = 1 second).
easing swing String A string indicating which easing function to use for the transition.
complete [none] Function() A function to call once the animation is complete.

jQuery also has a corresponding show() function that will show your content.