How can get length on checked checkbox array javascript

后端 未结 11 628
旧巷少年郎
旧巷少年郎 2020-12-29 08:16
11条回答
  •  爱一瞬间的悲伤
    2020-12-29 09:10

    Doing it with jQuery would shorten the code and make it more readable, maintainable and easier to understand. Use attribute selector with :checked selector

    Live Demo

    $('[name="cbox[]"]:checked').length
    

提交回复
热议问题