How to get number of selected options using jquery?

后端 未结 4 463
谎友^
谎友^ 2020-12-13 12:19

I have a multiple selection list which have more than 5 options. But i want to restrict the selection of the options to 2 or 3 options. How to do it using jquery? How to get

4条回答
  •  抹茶落季
    2020-12-13 12:49

    var n = $("input:checked").length; see this for more detail: http://api.jquery.com/checked-selector/

提交回复
热议问题