With this html:
<div class="outer">
<div class="inner">
<span class="selection" title="Green"></span>
</div>
<div class="inner">
<span class="selection" title="Yellow"></span>
</div>
<div class="inner">
<span class="selection" title="Red"></span>
</div>
</div>
and this existing jQuery which can be changed as necessary:
$(document).ready(function(){
$('.outer .inner span.selection').each(function(){
if($(this).attr('title', 'Green')) {
$(this).parent().css('background-color', 'green');
}
if($(this).attr('title', 'Yellow')) {
$(this).parent().css('background-color', 'yellow');
}
if($(this).attr('title', 'Red')) {
$(this).parent().css('background-color', 'red');
}
});
});
Essentially this only displays a single item in a dropdown. I'm looking to change the list item displayed as a single color. Other list items that aren't selected are hidden.