クラス名が「.ct」の20個のselectを含むページがあります。3つ以上のオプションを含むselectが存在するかどうかを判断するセレクターが必要です。
ありがとう、クリス
次のように、n番目の子セレクターを使用して3番目をチェックできます<option>。
if ($('select.ct option:nth-child(3)').length)
; // Do stuff
var elem=$('select.ct');
var exist=false;
$.each(elem,function(index,value){
if(value.length>2)
{
exist=true;
return
}
})
if(exist)
alert('select option with option greater than 3 exist')
else
alert('no select option exist greater than 3')