Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use toggle () in jQuery

Shulou Source: shulou.com Published: 2022-06-01 03:23:48 10月25日 Update

Editor to share with you how to use toggle () in jQuery, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

JQuery toggle ()

With jQuery, you can use the toggle () method to switch between the hide () and show () methods.

Show hidden elements and hide displayed elements:

Example

$("button") .click (function () {

("p") .toggle ()

});

Syntax:

$(selector) .toggle (speed,callback)

The optional speed parameter specifies the speed at which to hide / show. You can take the following values: "slow", "fast", or milliseconds.

The optional callback argument is the name of the function that executes after the toggle () method completes.

The above is all the contents of the article "how to use toggle () in jQuery". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Methods articles elements content parameters not much functions names most examples more knowledge industry grammar information information channels speed channels post switch Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno MySQL Microsoft Redmi