jQuery Effect - hide() Method
Example
Hide the visible <p> element:
$(".btn1").click(function(){ $("p").hide(); });
Definition and Usage
If the selected element is already displayed, hide the element.
Syntax
$(selector).hide(speed,callback)
Parameters | Description |
---|---|
speed |
Optional. Specify the speed of the element from visible to hidden. The default is "0". Possible values:
When setting the speed, the element will gradually change its height, width, margin, padding, and opacity during the process from visible to hidden. |
callback |
Optional. The function to be executed after the hide function is executed. For more information about callback, please visit our jQuery Callback chapter. This parameter cannot be set unless the speed parameter is set. |
Tips and Comments
Tip:If the element is already fully visible, the effect does not produce any change unless a callback function is specified.
More examples
- Use the speed parameter
- Use the speed parameter to hide and show elements.
- Use the speed and callback parameters
- Use the speed and callback parameters to hide and show elements.