Question: I have this JavaScript code:

```
$(document).ready(function(){
    $('#CustomersResellers').hide();

    $('input.ShowResellerAccounts').on('click', function(){
        if($(this).is(':checked')){
            alert('checked');
        }
    });
});

```

which shows the alert when I check the box, but if the box is already checked on page load, it does not show the alert.

Answer: 
Of course it should not be shown, because nowhere in your code you attached event handler when checkbox is checked. So just add a hanlder, when checkbox is checked, like this

```
$(document).ready(function(){
    $('#CustomersResellers').hide();

    // Define a handle to avoid duplication 
    function handler(){
      alert('checked');   
    }

    if ($('input.ShowResellerAccounts').is(':checked')){
       handler();
    }

    $('input.ShowResellerAccounts').on('click', function(){
        if($(this).is(':checked')){
            handler();
        }
    });
});

```
This is exactly the behavior I would expect. 
`if $(this).is(':checked')` means 'if this checkbox is checked' - then show the alert. But when you click to uncheck the box (`on('click'...)`), it becomes unchecked and alert does not show.