I have an issue that i am trying to get the values from checkbox to jquery but am getting only one value and all the checkbox have that value, here is my code:
<form method="post">
@foreach($services as $service)
<tr>
<td><input type="checkbox" onchange="check()" name="check_box" id="check_box" value=></td>
<td></td>
</tr>
@endforeach
<form>
Service names are multiple and user can select multiple options and i want to get multiple options in jquery, here is my code for jquery:
<script type="text/javascript">
function check(){
var testing = document.getElementById('check_box').value;
console.log(testing);
}
</script>
It is only giving the value of 1st loop.
Can anyone help me?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire