Get checkbox values using checkbox name using jquery

前端 未结 8 1847
刺人心
刺人心 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:41

    I would like to add that if you're trying to get all of the check-boxes with that name that have been selected, you would want to use the following syntax:

    $("[name='bla[]']:checked").each(function () {
        // do stuff
    });
    

    Make sure there is not a space between the closing ] and :checked

提交回复
热议问题