Ads 468x60px

Tuesday, July 9, 2013

One Click Select all Checkbox in Jquery


HTML
<label for="selectAll"><input type="checkbox" id="selectAll"> Select all</label>

<label for="ceckbox_1"><input type="checkbox" id="ceckbox_1" class="selectbox">Checkbox One</label>

<label for="ceckbox_2"><input type="checkbox" id="ceckbox_2" class="selectbox">Checkbox Two</label>

<label for="ceckbox_3"><input type="checkbox" id="ceckbox_3" class="selectbox">Checkbox Three</label>
Jquery
    $(document).ready(function(){
        $('#selectAll').on('click', function(){
            $('.selectbox').attr('checked', $(this).is(":checked"));
        });
    });

Demo Link

0 comments:

Post a Comment