Get checkbox values using checkbox name using jquery

前端 未结 8 1854
刺人心
刺人心 2021-02-05 00:32

I have several input checkboxes, (they name is same for send array on server).

So, I need get each value this checkboxes and I want use as selector checkbox names, this

8条回答
  •  春和景丽
    2021-02-05 00:51

    If you like to get a list of all values of checked checkboxes (e.g. to send them as a list in one AJAX call to the server), you could get that list with:

    var list = $("input[name='bla[]']:checked").map(function () {
        return this.value;
    }).get();
    

提交回复
热议问题