Summary: I would like to call an external function upon a status change for a checkbox.
The following code which includes the function to call upon the change works (code available at JSFiddle, commented section)
HTML
<input type="checkbox" id="cb">
JS
$("#cb").change(function () {
        if ($("#cb").prop('checked'))
        {
            alert('checked');
        } else {
            alert('unchecked')
        }
    });
As expected, an alert is raised when checking or unchecking the checkbox.
I now want to move the function part outside the .change() method:
$("#cb").change(alertme());
function alertme () {
        if ($("#cb").prop('checked'))
        {
            alert('checked');
        } else {
            alert('unchecked')
        }
    }
This does not work anymore (no alert on status change). Why is it so?