select button element

selects the button elements on a page and gets the buttons value attribute

HTML

<input type="button" danhbo="1" />
<input type="button" danhbo="2" />
<input type="button" danhbo="3" />
<input type="button" danhbo="4" />
<input type="button" danhbo="5" />

JavaScript

$(":button").each(function(){
    $(this).on('click', function(){
        var x = $(this).attr(danhbo');
        alert("test " + x);
    });
});