$j(document).ready(function () {
$j('#checkboxToggle').click(function () {
$j("input[type=checkbox]").each(function () {
if (this.checked == true) {
$j("input[type=checkbox]").attr('checked', false);
}
else {
$j("input[type=checkbox]").attr('checked', true);
}
});
});
});
</script>
---------------------------------------------------------------------------------------------------
IN JS
---------
<html> <head> <script language='JavaScript'> checked = false; function checkedAll () { if (checked == false){checked = true}else{checked = false} for (var i = 0; i < document.getElementById('myform').elements.length; i++) { document.getElementById('myform').elements[i].checked = checked; } } </script> </head> <body> <form id="myform"> <input type="checkbox" name="foo"/> <input type="checkbox" name="bar"/> <BR>Check all: <input type='checkbox' name='checkall' onclick='checkedAll();'> </form> </body> </html>
No comments:
Post a Comment