[whatwg] Return values of on* event handlers

Dean Edwards dean at edwards.name
Sun Jul 23 14:37:20 PDT 2006

Boris Zbarsky wrote:
> Consider the following testcase:
> <!DOCTYPE html>
> <a href="http://www.example.com" onclick="return 0">Click me</a>
> Should clicking the link load www.example.com?

Yes. You should explicitly return "false" to cancel an event.

Most event handlers return nothing (undefined) which is equivalent to 
false. So equivalence is not good enough.


More information about the whatwg mailing list