How to use toggle () in jQuery
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!