Well, let's keep them simple, shall we. First off, using pure HTML + CSS:
<div id="emotion">
<input type="radio" name="emotion" id="sad" /><label for="sad"><img src="sad_image.png" alt="I'm sad" /></label>
<input type="radio" name="emotion" id="happy" /><label for="happy"><img src="happy_image.png" alt="I'm happy" /></label>
</div>
This will degrade nicely if there's no Javascript. Now for some jQuery goodness. First off, creating the CSS classes we'll need:
.input_hidden {
position: absolute;
left: -9999px;
}
.selected {
background-color: #ccc;
}
#emotion label {
display: inline-block;
cursor: pointer;
}
#emotion label img {
padding: 3px;
}
Now for the Javascript:
$('#emotion input:radio').addClass('input_hidden');
$('#emotion label').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
});
The reason why we're not using display: hidden
here is for accessibility reasons. See: http://www.jsfiddle.net/yijiang/Zgh24/1 for a live demo, with something more fancy.