select button element
selects the button elements on a page and gets the buttons value attribute
by Oliver Kelso
HTML
<input type="button" value="1" />
<input type="button" value="2" />
<input type="button" value="3" />
<input type="button" value="4" />
<input type="button" value="5" />
JavaScript
$(":button").each(function(){
$(this).on('click', function(){
var x = $(this).attr('value');
alert("test " + x);
});
});