Malde Chavda Malde Chavda - 2 years ago 131
Javascript Question

Jquery Toggle two function not work in 1.10.1

Jquery Toggle two function not work in jquery 1.10.1 but work's on Jquery 1.8.3


<p>For example, consider the HTML:</p>
<div id="target">
Click here


$('#target').toggle(function() {
alert('First handler for .toggle() called.');
}, function() {
alert('Second handler for .toggle() called.');

and expmple is here

Answer Source

Dude it doesn't works in jQuery 1.10.1

Still there is another way to do it...

$(function () {
    function first() {
       //Code for first time click goes here
        $(this).one("click", second);
    function second() {
        //Code for second time click goes here
        $(this).one("click", first);
    $("#target").one("click", first);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download