2009-10-06 5 views

Répondre

2
var selects = $('select').filter(function() { 
    return $(this).find('option').length === 2 
}); 

ou:

var selects = $('select').filter(function() { 
    return $('option', this).length === 2; 
}); 
3

Cela fonctionne également:

$('select:has(option:first-child + option:last-child)'); 

Fondamentalement, il recherche un élément select qui contient un élément option qui est le premier enfant et est adjacent à un option c'est le dernier enfant.

+0

bien, je n'y ai pas pensé. –

Questions connexes