in JQuery, you can use the Hide () and show () methods to hide and show HTML elements, and use the toggle () method to toggle the Hide () and show () methods.
Hide, show, toggle, swipe, fade, and animate, wow!
Click Show/Hide panel
Instance
JQuery Hide ()
Simple jquery Hide () method demo.
JQuery Hide ()
Another hide () instance. Demonstrates how to hide text.
JQuery Hide () and show ()
With JQuery, you can use the Hide () and show () methods to hide and display HTML elements:
Instance $ ("#hide"). Click (function () {
$ ("P"). Hide ();
});
$ ("#show"). Click (function () {
$ ("P"). Show ();
});
Try it?
Grammar:
$(
selector). Hide (
Speed,callback);
$(
selector). Show (
Speed,callback);
The optional speed parameter specifies the rate of concealment/display, which can take the following values: "Slow", "fast", or milliseconds.
The optional callback parameter is the name of the function that is executed after the hide or display is complete.
The following example shows the Hide () method with the speed parameter:
Instance $ ("button"). Click (function () {
$ ("P"). Hide (1000);
});
Try it?
JQuery Toggle ()
With JQuery, you can use the toggle () method to toggle the Hide () and show () methods.
Displays the elements that are hidden and hides the displayed elements:
Instance $ ("button"). Click (function () {
$ ("P"). Toggle ();
});
Try it?
Grammar:
$(
selector). Toggle (
Speed,callback);
The optional speed parameter specifies the rate of concealment/display, which can take the following values: "Slow", "fast", or milliseconds.
The optional callback parameter is the function name that is executed after the toggle () method completes.
The optional callback parameter has the following three-point description:
- $ (selector) The number of selected elements is N, then the callback function executes n times
- Parentheses after the callback function name will execute the function body immediately, rather than wait until the show/hide is complete.
- Callback can be either a function name or an anonymous function
JQuery Effects – Hide and show