Select all Checkbox in Javascript::
<script type="text/javascript">
$(document).ready(function(){
$("#checkbx_selectall").on(' change', function() {
if(this.checked){
$('.__chckbx_select').each( function(){
this.checked=true;
});
}else{
$('.__chckbx_select').each( function(){
this.checked=false;
});
}
});
$('.__chckbx_select').on(' change',function(){
if($('.__chckbx_select: checked').length == $('.__chckbx_select').length){
$('#checkbx_selectall').prop(' checked',true);
}else{
$('#checkbx_selectall').prop(' checked',false);
}
});
});
</script>
source: http://stackofcodes.in/
No comments:
Post a Comment