Edit in JSFiddle

var matchingListItem = function(){
  var optionValue = $( "option:selected" ).val();
  //show li that has optionValue value of the selected
    //index the items
  $( "#list-container li" ).each(function(i, item){
  		//if the item has the passed through variable
	  	if($( item ).hasClass( optionValue )){
      //then we will show it
    	$( item ).show();
    }
    	//if not, then we will hide it
    	else {
      $(item).hide();
      }
  });

 };

$( "select" ).change( matchingListItem );
matchingListItem();