mootools many buttons with one function to handle

Posted by Roby on Stack Overflow See other posts from Stack Overflow or by Roby
Published on 2012-09-03T06:48:36Z Indexed on 2012/09/04 9:38 UTC
Read the original article Hit count: 332

Filed under:
|
|

i want to create a button list like

<form id="form">
<input type="button" value="skip">
<input type="button" value="continue">
<input type="button" value="bla">
<input type="button" value="blubb">
</form>

and want to post this via a request to a php script witch should get somethink like button "skip" was clicked.

but i dont want to make a function for every button. one function for all button.

i think it should work with the mootools relay function.

$('form').addEvent('click:relay(type=button)', function(){
    alert(this.value);
});

or somethink like this ? :-/ hopefully someone could help me

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript