Computer Science, asked by sham4937, 1 year ago

How to trigger event in JavaScript?

Answers

Answered by Genuinegirl
0

Here is your answer buddy...

You can use fireEvent on IE 8 or lower, and w3c's dispatchEvent on most other browsers. To create the event you want to fire, you can use either createEvent or createEventObject depending on the browser.

Here is a self-explanatory piece of code (from prototype) that fires an event dataavailable on an element:

var event; // The custom event that will be created

if (document.createEvent) {

event = document.createEvent("HTMLEvents");

event.initEvent("dataavailable", true, true);

} else {

event = document.createEventObject();

event.eventType = "dataavailable";

}

event.eventName = "dataavailable";

if (document.createEvent) {

element.dispatchEvent(event);

} else {

element.fireEvent("on" + event.eventType, event);

}

#Hope it helps..

# pleasured to help

#Be brainly...:)

Answered by fedcheri000
0

just use c++ you illiterate being

Similar questions