How to check all chackbox onclick function via javascript
How to check all chackbox onclick function via javascript
<script type="application/javascript">
function checkAllbox(array_with_id_values)
{
for (var i = 0, ilen = array_with_id_values.length; i < ilen; i++)
{
document.getElementById(array_with_id_values[i]).checked = true;
}
}
</script>
<a href="javascript:void(0)" onClick="checkAllbox(['a1','a2','a3'])">select all</a>
Where a1,a2,a3 are different id checkbox
<script type="application/javascript">
function checkAllbox(array_with_id_values)
{
for (var i = 0, ilen = array_with_id_values.length; i < ilen; i++)
{
document.getElementById(array_with_id_values[i]).checked = true;
}
}
</script>
<a href="javascript:void(0)" onClick="checkAllbox(['a1','a2','a3'])">select all</a>
Where a1,a2,a3 are different id checkbox
Comments
Post a Comment