I have multiple radio button name in array with same values as 1 for all. I need want to get if uncheck means set as zero how can I do that. Below is my code
check image
use it like.
<form method='post' id='userform' action='test2.php'> <tr>
<td>Trouble Type</td>
<td>
<input type='checkbox' name='checkboxvar[]' class="check" value='1'>1<br>
<input type='checkbox' name='checkboxvar[]' class="check" value='1'>2<br>
<input type='checkbox' name='checkboxvar[]' class="check" value='1'>3
</td> </tr> </table> <input type='button' class='buttons'> </form>
<script type="text/javascript">
$(document).ready(function(){
$('.buttons').click(function(){
var checkbox_arr = [];
$('.check').each(function(){
checkbox_arr.push(+$(this).is( ':checked' ));
});
console.log(checkbox_arr);
});
});
</script>