How to trigger event in JavaScript?
Answers
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...:)
just use c++ you illiterate being