I have a button with a onclick attribute which is pointing to the function test().
test()
Button 1 <
just add id to each button and pass it to your test function
and here is working jsfiddle
1 2 3