You can use dispatchEvent
to programatically trigger events:
var event = new MouseEvent('dblclick', {
'view': window,
'bubbles': true,
'cancelable': true
});
document.getElementById('aa').dispatchEvent(event);
See the section “Triggering built-in events” on MDN.
More Related Contents:
- What exactly is the parameter e (event) and why pass it to JavaScript functions?
- When a ‘blur’ event occurs, how can I find out which element focus went *to*?
- Javascript – How to detect if document has loaded (IE 7/Firefox 3)
- “this” keyword in event methods when using JavaScript prototype object
- JavaScript / jQuery: Test if window has focus
- How to stop event bubbling on checkbox click
- Accessing an object’s property from an event listener call in JavaScript
- ‘this’ does not work properly in another event. I’m clueless as to why [duplicate]
- Pass mouse events through absolutely-positioned element
- How to pass event as argument to an inline event handler in JavaScript?
- jQuery equivalent of JavaScript’s addEventListener method
- Get index of clicked element in collection with jQuery
- How to stop default link click behavior with jQuery
- JavaScript: DOM load events, execution sequence, and $(document).ready()
- how to move a div with arrow keys
- jQuery Change event on an element – any way to retain previous value?
- jQuery Mobile : What is the order of page events triggering?
- Difference between document.addEventListener and window.addEventListener?
- How to know if .keyup() is a character key (jQuery)
- Remove key press delay in Javascript
- Event fired when clearing text input on IE10 with clear icon
- How do I handle a click anywhere in the page, even when a certain element stops the propagation?
- Internet Explorer and JavaScript event currentTarget
- Event propagation in Javascript
- jQuery – How can I temporarily disable the onclick event listener after the event has been fired?
- Is it bad practice to use inline event handlers in HTML? [closed]
- How to disable mouseout events triggered by child elements?
- Prototype equivalent for jQuery live function
- jquery keypress event object keyCode for firefox problem?
- One time event handling using promises?