i need help, anybody help me for checkbox using javascript? this is my script:
<!DOCTYPE html>
<html>
<head>
<title>jQuery With Example</title>
@Scripts.Render("~/bundles/jquery")
<script type="text/javascript">
$(function () {
var chkId = '';
$('.chkNumber:checked').each(function () {
chkId += $(this).val() + ",";
});
chkId = chkId.slice(0, -1);
$('.chkSelectAll').click(function () {
$('.chkNumber').prop('checked', $(this).is(':checked'));
});
});
</script>
</head>
<body>
<table id="mytable">
<tr>
<td>
<input type="checkbox" class="chkSelectAll" />SelectAll
</td>
<td><input type="checkbox" class="chkNumber" value="1" />One</td>
<td><input type="checkbox" class="chkNumber" value="2" />Two</td>
<td><input type="checkbox" class="chkNumber" value="3" />Three</td>
<td><input type="checkbox" class="chkNumber" value="4" />Four</td>
<td><input type="checkbox" class="chkNumber" value="5" />Five<br /></td>
</tr>
</table>
</body>
</html>
i want if i checked/unchecked all value 1-5 class(chkSelectAll) is checked/unchecked.
give me solution please...