[Javascript] Which submit caused the event?

Hassan Schroeder hassan at webtuitive.com
Tue Jan 1 10:55:43 CST 2013


On 1/1/13 8:04 AM, Tedd Sperling wrote:

> Let's say I have a form containing three input statement, like so:
>
> <form action="" method="post" name="myform"  onsubmit="javascript:test(); return false;" >
>     < input type="submit" name="edit" value="Edit">
>     < input type="submit" name="save" value="Save">
>     < input type="submit" name="cancel" value="Cancel">
> </form>
>
> If this form is submitted, how can I tell what the user clicked via JavaScript?

event.target or event.srcElement (IE-specific)

-- 
:about => about.me/hassanschroeder
:email  => hassan at webtuitive.com
:twitter => @hassan
:voice  => +1 408-621-3445


More information about the Javascript mailing list