JQuery Effects – Hide and show

Source: Internet
Author: User

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:

      1. $ (selector) The number of selected elements is N, then the callback function executes n times
      2. Parentheses after the callback function name will execute the function body immediately, rather than wait until the show/hide is complete.
      3. Callback can be either a function name or an anonymous function

JQuery Effects – Hide and show

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.