Canceling events

A

alex

Hi,
I have code that looks like this:

function setupEventWrapper(obj) {
old_ev_handler = obj.onsubmit;
obj.onsubmit = function () {
do_something();
if (old_ev_handler != undefined) {
old_ev_handler();
}
if (event_cancelled()) {
undo_something();
}
}
}

it wraps the onsubmit handler (if any) within a new function which
do_something() and then calls the old event handler.

My problem is how can I detect if the event has been canceled by
old_ev_handler(). AFAIK an event can be cancelled in three ways:

* returning false, easy to check for

* setting event.returnValue = false on IE, easy to check for

* calling event.preventDefault() on DOM

How can I check if event.preventDefault() has been called?




Thanks in advance
 
A

alex

alex said:
* calling event.preventDefault() on DOM

How can I check if event.preventDefault() has been called?

I answer myself, I've missed event.getPreventDefault()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top