$('select').change(function(){ $('.blocks > div').removeClass('selected') .eq(this.selectedIndex || 0).addClass('selected') });