nolachrymose
11-30-2003, 02:34 PM
I'm working with custom events, and I've run into a problem - when I dispatch the event (with dispatchEvent()) to the body of the page, it won't fire the function I assigned to the event handler, and instead I have to use event listeners. Is there any way to overcome this problem?
Any help is greatly appreciated. Thanks! :)
If in an HTML attribute:
document.addEventListener("mycustomevent", function(event) {
eval(event.target.getAttribute("onmycustomevent"));
}, true);
Else if assigned via javascript:
document.addEventListener("mycustomevent", function(event) {
event.target.onmycustomevent();
}, true);
You might want to change the true to the false if you want to fire it on bubbling instead of on capturing, but whatever. The gist is there.
nolachrymose
11-30-2003, 04:58 PM
Thanks, jkd!
You might want to change the true to the false if you want to fire it on bubbling instead of on capturing, but whatever.
I didn't even realize, heh. *changed*