How to display an alert box when ticking checkbox in Jquery? The alert box will disappear when checkbox is unticked.

I have tried the code below,but it doesn't work. Can anyone help me out? Thanks!

```
<script type="text/javascript">
        $(document).ready(function(){

            if($('#chkAll').is(':checked'))
           {
              alert("im checked");

           }

        });
        </script>
<input id="chkAll" />

```