Side navigation
#7921 closed enhancement (invalid)
Opened January 07, 2011 04:20PM UTC
Closed January 07, 2011 04:26PM UTC
Last modified January 07, 2011 09:17PM UTC
.click() does not trigger event bound with .toggle()
Reported by: | jmagner@genuineinteractive.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.next |
Component: | event | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If an event handler is bound using .toggle(),
$('#elem').toggle(function(e){ console.log('toggle state 1'); }, function(e){ console.log('toggle state 2'); }, function(e){ console.log('toggle state 3'); });
There should be a way to invoke an event on this.
$('#elem').click(); // does not work
This would be particularly useful in cases where you'd want to 'hide' something when another, outside event occurred.
Attachments (0)
Change History (4)
Changed January 07, 2011 04:26PM UTC by comment:1
_comment0: | `toggle()` is not intended to respond to the 'click' event. → 1294424920127632 |
---|---|
_comment1: | `toggle()` is not intended to respond to the 'click' event, unless you specify and trigger the click event on the specified element. → 1294424936881153 |
resolution: | → invalid |
status: | new → closed |
Changed January 07, 2011 04:29PM UTC by comment:2
Derived from the docs at: http://api.jquery.com/toggle
Changed January 07, 2011 06:23PM UTC by comment:3
Changed January 07, 2011 09:17PM UTC by comment:4
component: | unfiled → event |
---|---|
description: | If an event handler is bound using .toggle(), \ \ $('#elem').toggle(function(e){ \ console.log('toggle state 1'); \ }, function(e){ \ console.log('toggle state 2'); \ }, function(e){ \ console.log('toggle state 3'); \ }); \ \ There should be a way to invoke an event on this. \ \ $('#elem').click(); // does not work \ \ This would be particularly useful in cases where you'd want to 'hide' something when another, outside event occurred. → If an event handler is bound using .toggle(), \ {{{ \ $('#elem').toggle(function(e){ \ console.log('toggle state 1'); \ }, function(e){ \ console.log('toggle state 2'); \ }, function(e){ \ console.log('toggle state 3'); \ }); \ }}} \ There should be a way to invoke an event on this. \ \ $('#elem').click(); // does not work \ \ This would be particularly useful in cases where you'd want to 'hide' something when another, outside event occurred. |
toggle()
is not intended to respond to the 'click' event, unless you trigger the click event on the specified element.