How to Use JQuery toggle() With Example?

You can also hide and show the element through the toggle method.In jQuery it is defined by toggle ().

JQuery toggle() Method, Use JQuery toggle() Function

It simply means to show the element which is hide and hide the element which is show.But now you must be thinking that we were doing this earlier also, what is new in this?So new in this is that all this will be done through a single button.

For example, let us see a code:




<!DOCTYPE html>
<script src=""></script>
<button>Toggle between hiding and showing</button>
<p>This is a paragraph with experts php.</p>
<p>This is another experts php.</p>