Counting the number of option tags in a select tag in jQuery

前端 未结 8 1767
夕颜
夕颜 2020-12-04 18:39

How do I count the number of s in a

相关标签:
8条回答
  • 2020-12-04 19:26
    $('#input1 option').length;
    

    This will produce 2.

    0 讨论(0)
  • 2020-12-04 19:28

    Another approach that can be useful.

    $('#select-id').find('option').length
    
    0 讨论(0)
提交回复
热议问题