I'm trying to get value of selected checkbox in my ajax form on onclick event. The problem is that nothing is working and I cant get that value
<td>
<input type="checkbox" value="30" name="checkbox15" id="checkbox2" class="css-checkbox"><label for="checkbox2" class="css-label radGroup label_border css-checkbox_cl clr"> test</label>
<input type="checkbox" value="23" name="checkbox15" id="checkbox3" class="css-checkbox"><label for="checkbox3" class="css-label radGroup label_border css-checkbox_cl clr"> test2</label>
<input type="checkbox" value="15" name="checkbox15" id="checkbox4" class="css-checkbox"><label for="checkbox4" class="css-label radGroup label_border css-checkbox_cl clr"> test3</label>
</td>
I tried to get values by this code
$(".css-checkbox").click(function(event){
event.preventDefault();
var searchIDs = $("input:checkbox").map(function(){
// return $(this).val();
}).get(); // <----
console.log(searchIDs);
});
And it returns empty array . Can somebody please help me ?
Link to JSFIDDLE