i have an array of checkbox (to use with php), bu i want to use ajax to make somethings with this values from checkbox, i want to get the value from each checkbox and make an ajax request.
I have this:
$("#checked").each(function(i, val){
var k = $(i).value();
console.log(k);
});
but no success.
html:
<input id="checado" type="checkbox" name="ids[]" value="78">
<input id="checado" type="checkbox" name="ids[]" value="79">
<input id="checado" type="checkbox" name="ids[]" value="80">
<input id="checado" type="checkbox" name="ids[]" value="81">
this.valueor$(this).val().$('.checked')instead..eachdocumentation and figure which parameters are passed to the callback. As you can see, the first argument passed is the index of the element in the set, and the second argument is the element itself. So, why are you passing the index (a number) to jQuery? Second, if you search for.value, you'll notice that there is no such method. I highly recommend to read the jQuery tutorial before you continue.