3 回答
            3        
        
		
Try
$('select.color option:contains(white)').prop('selected','selected');
Select all the elements whose selected option is "white".
$('select.color option:contains(white):selected').parent('select');
Match Exact value
$('select.color option:contains(white):selected').each(function(){
    if($(this).text() == 'white'){
        $(this).parent('select').css('color','blue');
    }
});
于 2013-09-13T06:49:42.463   回答
    
    
            2        
        
		
尝试这个。
$("select.color option:selected:contains(white)").parent();
这将为您提供所有具有以白色开头的文本的选择元素
注意:它也会匹配whitesmoke
编辑:以下代码将为您提供确切的值。
var requiredelements = $("select.color option:selected").filter(
    function()
    {
    return ( $.trim($(this).text())=== 'white')
    }).parent('select');
alert(requiredelements.length);
于 2013-09-13T07:11:23.637   回答
    
    
            1        
        
		
$('select.color').each(function(index, element) {
 if($(this).find('option:selected').text()=='white') {
  // do something with select box which contains white text or use array to get all contents
 }
});
于 2013-09-13T07:27:11.977   回答