Click Toggle (jQuery)

click, javascript, jquery, toggle

Solution

$('li').toggle(function() {
 alert(1)
}, function() {
 alert(2);
});

Problem

``` $("li").hover( function () { // do x }, function () { // do y }); ``` .. thats for hover, how would I do the same for click toggle, i.e do x on click and y on second click? Manythanks

Original source