Skip to content

It is odd when using "attr" on checkbox, it works on the first time only #652

Closed
@LeonLi0102

Description

@LeonLi0102
<textarea>




<title>Checkbox Test</title>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script>
    $().ready(function(){       
        $("#checkControl").click(function(){            
            // It is odd it works only on the first time whey you click 'All/None'  
             $("input[name='check_items']").attr("checked",this.checked);
             
            // I know this will work, but still the code above is confused me.
            // $("input[name='check_items']").prop("checked",this.checked);
             
        });     
    });     
    </script>


All/None

item1
item2
</textarea>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions