13. Use the Toggle () method to bind multiple functions

Source: Internet
Author: User

toggle()The method can bind two or more than two functions in the element's click event, and it can also implement the toggle between hiding and displaying the element, and the calling format for binding multiple functions is as follows:

$(selector).toggle(fun1(),fun2(),funN(),...)

Where Fun1,fun2 is the name of multiple functions

For example, use a toggle() method that displays different content each time you click the <div> element, as shown in:

Effects displayed in the browser:

As you can see, each time you click on the <div> element, you execute the toggle() function of the method binding sequentially, and when you execute to the last function, clicking again will return to executing the first function.

Note: the toggle () method supports the current mainstream stable jquery version of 1.8.2, which is not supported in versions after 1.9.0.

13. Use the Toggle () method to bind multiple functions

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.