Skip to content

Update event-helpers.md #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions page/events/event-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,3 @@ $( "#menu li" ).hover(function() {
$( this ).toggleClass( "hover" );
});
```

### `.toggle()`

<div class="warning">Note: This method signature was removed in jQuery 1.9. jQuery also provides an animation method named .toggle() that toggles the visibility of elements.</div>

The [`.toggle()`](http://api.jquery.com/toggle-event/) method is triggered by the "click" event and accepts two or
more functions. Each time the click event occurs, the next function in the
list is called. Generally, `.toggle()` is used with just two functions;
however, it will accept an unlimited number of functions. Be careful, though:
providing a long list of functions can be difficult to debug.

```
// The toggle helper function
$( "p.expander" ).toggle( function() {
$( this ).prev().addClass( "open" );
}, function() {
$( this ).prev().removeClass( "open" );
});
```