Multiple Identical functions #2

by Joe Saad

HTML

<input type="checkbox" />
<input type="checkbox" checked="checked" />
<input type="checkbox" />
<input type="checkbox" checked="checked" />
<input type="checkbox" />
<input type="checkbox" />

CSS

input { clear:left;margin:5px 0;}

JavaScript

$(function() {

    var markChecked = function() {
        if ($(this).is(':checked')) {
            $(this).after('this is checked');
        }
    };

    $('input').each(markChecked).click(markChecked);
});