Get checkbox list values with jQuery

后端 未结 8 1897
抹茶落季
抹茶落季 2020-12-13 18:35

In a div, I have some checkbox. I\'d like when I push a button get all the name of all check box checked. Could you tell me how to do this ?

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 18:36

    Try this one..

    var listCheck = [];
    console.log($("input[name='YourCheckBokName[]']"));
    $("input[name='YourCheckBokName[]']:checked").each(function() {
         console.log($(this).val());
         listCheck .push($(this).val());
    });
    console.log(listCheck);
    

提交回复
热议问题