Count them if there are more than desired unselect the extra one or do whatever you need with the list when you have already 2 selected ( like disable it )
Fiddle: http://jsfiddle.net/6kMWu/
$('#color > option').on('click', function (e) {
var selected = ($('#color > option:selected').length);
console.log(e.target);
if(selected > 2)
{
$(e.target).removeAttr('selected');
return false;
e.preventDefault();
}
});