get checked checkbox jquery by name 1

get checked checkbox jquery by name

//option 1:
checkboxes.filter(":checked").map(function () {
    return this.value;
}).get()

//Option 2
var selected = [];
$('[name="price[]"]:checked').each(function(checkbox) {
selected.push(checkbox);
});

Here is what the above code is Doing:
1. First, we select all the checkboxes that are checked.
2. Then, we map over the checkboxes and return the value of each checkbox.
3. Finally, we use the get() method to return the values as an array.

Similar Posts