I have this code here in my ajax:
var userCheckbox = $("input[name=chk]:checked").val();
and this is the checkbox in my html:
<input id="checkbx" type="checkbox" name="chk" value="apple"/>apple</td>
<input id="checkbx" type="checkbox" name="chk" value="corn"/>corn</td>
<input id="checkbx" type="checkbox" name="chk" value="tomato"/>tomato</td>
<input id="checkbx" type="checkbox" name="chk" value="juice"/>juice</td>
but I'm only getting one value. how can I get multiple values? someone said to me that I should use a loop statement but I don't know where to put it.
can anyone please help. thanks in advance.