I have a form with several checkboxes that I'm trying to check/uncheck by clicking certain links. It works the first time I use it, but then fails every time there after. Code is:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Checkbox Test</title>
<script type="text/javascript" src="/js/jquery.js"></script>
<script language="javascript">
    $('document').ready(function() {
        $('#chkAll').click(function() {
            $('input[type="checkbox"]').attr('checked', 'checked');
        });
        $('#unChkAll').click(function() {
            $('input[type="checkbox"]').removeAttr('checked');
        });
    });
</script>
<style type="text/css"> 
span {
    text-decoration: underline;
    cursor: pointer;
}
</style>
</head>
<body>
<h2>Checkbox Test</h2>
<form name="form1" method="post" action="">
    <p>
        <label>
            <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_0">
            Checkbox</label>
        <br>
        <label>
            <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_1">
            Checkbox</label>
        <br>
    </p>
</form>
<p><span id="chkAll">Check All</span> / <span id="unChkAll">Uncheck all</span></p>
</body>
</html>
I'm not sure what going on here. When I inspect the input element using firebug, it shows the "Checked" attribute being set and unset. Yet, when actually looking at the checkboxes, nothing changes.
Help is required.
 
     
     
    