私の DOM には 53 以上の同様select
のセクションがあり、ユーザーが選択した特定のオプションの数を数える必要があります。
私の DOM の例は次のようになります。
<select name="attendance" class="dd" id="20130101">
<option>p</option>
<option>a</option>
<option>s</option>
</select>
<select name="attendance" class="dd" id="20130102">
<option>p</option>
<option>a</option>
<option>s</option>
</select>
... x 51 more times!
私がやりたいのは、たとえばユーザーが「a」を選択したオプションの数量 (カウント) を返すことです。試してみ$('.dd option:selected').length
ましたが、選択したすべてのセクションの合計数 (53) が返されます。
助けてくれてありがとう!