need help in jqurry : I had made a small form with no.of checkboxes..When I click on Check all checkbox then all the checkbox gets checked automatically....Following is my code....
But I have taken the following code from internet only.Although its working but as I am new to jqurry I am not able to understand the script...Please help..

    <html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
    $("#checkAll").change(function () {
        $("input:checkbox").prop('checked', $(this).prop("checked"));
    	alert("Yoy have checked all");
    });
    });
    </script>
    </head>
    <body>
    <form>
        <p><label><input type="checkbox" id="checkAll"/> Check all</label></p>
        
        <fieldset>
            <legend>All Checkboxes</legend>
            <p><label><input type="checkbox" /> Option 1</label></p>
            <p><label><input type="checkbox" /> Option 2</label></p>
            <p><label><input type="checkbox" /> Option 3</label></p>
            <p><label><input type="checkbox" /> Option 4</label></p>
        </fieldset>
    </form>
    </body>
    </html>