Selecting element by data attribute
Shows how to set an object literal as a data item on a HTML element and then read it off as an object.
HTML
<button data-id='1'>One</button>
<button data-id='2'>Two</button>
JavaScript
$(function() {
$('button').filter(function(){ return $(this).data("id") == 2}).css({background:'red'});
});