I have been trying to make a jQuery function which selects all the checkboxes that are attached to it. This is the code that I have been working on. What am I doing wrong?
<div id=checkboxes>
<input type="checkbox" onclick="toggleChecked(this.checked)"> Select / Deselect All<br>
<input type="checkbox" />Eggs<br>
<input type="checkbox" />Butter<br>
<input type="checkbox" />Milk<br>
<input type="checkbox" />Bread<br>
<input type="checkbox" />Jam<br>
<input type="checkbox" />Tea<br>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
function toggleChecked(status)
$(document).ready(function(){
$("#checkall").click(function(){
var status = $(this).attr('checked');
$('.checkbox').attr('checked',status);
});
});
</script>
P.S: I found this code on the net. Seemed to be working for everyone else.
Check this link.It is working fine here.