Saturday, November 28, 2015

how to all checkbox checked in browser

Run this line in browser console:

$( "input[type=checkbox]" ).attr( "checked", "checked" );

Example:

<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$( document ).ready(function() {
  $( "input[type=checkbox]" ).attr( "checked", "checked" );
});
</script>
    <input type="checkbox" name="test" value="Hourly" checked="checked">

    <input type="checkbox" name="test" value="Daily">
    <input type="checkbox" name="test" value="Weekly">

    <input type="checkbox" name="test" value="Monthly" checked>
    <input type="checkbox" name="test" value="Yearly">

No comments:

Post a Comment