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

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

How do I count the number of s in a

8条回答
  •  时光取名叫无心
    2020-12-04 19:25

    Your question is a little confusing, but assuming you want to display the number of options in a panel:

    and

    $(function() {
      $("#preview").text($("#input1 option").length + " items");
    });
    

    Not sure I understand the rest of your question.

提交回复
热议问题