How do I alternate between calling two functions on click? For example, here is the button
<div id="fooButton" />
and here is the javascript
function fooOne() {
alert('foo One called');
}
function fooTwo() {
alert('foo Two called');
}
how do I call fooOne() and fooTwo() on alternate button clicks?
You can use the toggle pseudo-event:
Note: This is deprecated as of jQuery 1.8 and removed in jQuery 1.9+. You can use jQuery-migrate if you need this function anyway.