The Hide () and show () of jquery can be used to display and hide content. For example, the following example: jquery Hide () and show () can be used to display and hide content. For example, the following examples:
<!doctype html>
Basic syntax
$ (selector). Hide (Speed,callback);
$ (selector). Show (Speed,callback);
Optional parameter speed gives you the speed of showing or hiding content, you can use "slow", "fast", or a number to represent microseconds.
The Second optional parameter is a callback function that is called at the end of the display or hide. The following code hides content within 1 seconds:
$ ("button"). Click (function () {
$ ("P"). Hide (1000);
});
JQuery Toggle () method
Using the Toggle () method, you can implement alternating display and hidden content, such as:
$ ("button"). Click (function () {
$ ("P"). Toggle ();
});
The basic syntax is as follows:
$ (selector). Toggle (Speed,callback);
Optional parameter speed gives you the speed of showing or hiding content, you can use "slow", "fast", or a number to represent microseconds.
The Second optional parameter is a callback function that is called at the end of the display or hide.