Commit a6cfaa6a authored by S Anand's avatar S Anand
Browse files

DOC: $.dispatch() options

parent e6d65925
......@@ -330,12 +330,16 @@ $('script[type="text/html"]')
## $.dispatch
Triggers a native JavaScript event. For example:
```js
$('a.action').dispatch('click')
```
mimics a user click action on `a.action`. Unlike [$.trigger](https://api.jquery.com/trigger/),
this executes non-jQuery event handlers as well.
sends a click to `a.action`. Like [$.trigger](https://api.jquery.com/trigger/),
but this will fire non-jQuery event handlers as well.
### $.dispatch options
You can add an optional dict as the second parameter. It can have any
[event properties](https://developer.mozilla.org/en-US/docs/Web/API/Event#Properties)
......@@ -345,6 +349,12 @@ as attributes. For example:
$('a.action').dispatch('click', {bubbles: true, cancelable: false})
```
- bubbles: whether the event bubbles or not. default: true
- cancelable: whether the event is cancelable or not. default: true
- All other `new Event()` options will also work
https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events
## L.TopoJSON
......
/*
Usage: $(selector).dispatch(event, options)
Simulate the event on the selector.
$('a').dispatch('click')
$('input').dispatch('change')
Options
-------
- bubbles: whether the event bubbles or not. default: true
- cancelable: whether the event is cancelable or not. default: true
- All other `new Event()` options will also work
https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events
*/
var _event
try {
new Event('click')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment