Home >>jQuery Tutorial >jQuery toggle() Property

jQuery toggle() Property

jQuery toggle() Property

jQuery toggle() method in jQuery is used to add two or multiple functions to toggle between for the click event for the selected elements.



Parameter Values

Parameter Description
function It is a required parameter which is used to run a function every time when the selected element is clicked

Here is an Example of jQuery toggle() Method:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js">
function(){$(".txt").css({"color": "orange"});},
function(){$(".txt").css({"color": "lightgreen"});},
function(){$(".txt").css({"color": "purple"});},
function(){$(".txt").css({"color": "pink"});
<p class="txt" style="font-size:35px">Click Here</p>


Click Here