Multiple Identical functions #1

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 handler() {
    if ($(this).is(':checked')) {
       $(this).after('this is checked');
    }
}

$(function(){
    $('input').each(handler);
    $('input').click(handler);
});