Watch for change of the input[type="checkbox"]
<p>How can I run a function on checkbox change?</p>

<p>I'm trying to write small checkbox replacing function base on that - but I'm doing something wrong.</p>

<p>Code:</p>

<pre><code>(function($) {
        $.fn.checking = function() {
            if( $('.checbox').prop('checked', false) === true ) { 
                $('.new-checkbox').prop('id','unchecked');
            }
            else { 
                $('.new-checkbox').prop('id','checked'); 
            }  
        };
})(jQuery);


$(document).ready( function(){

    $('.checkbox').wrap('&lt;div class="checkbox-wrapper"&gt;&lt;/div&gt;');
    $('.checkbox-wrapper').append('&lt;p class="new-checkbox"&gt;Blue = Checked, Red = Unchecked&lt;/p&gt;');
    $('.checkbox').checking();
    $('.checbox').bind('change', function(){
        $(this).checking();

    });

});
</code></pre>

<p>PlayGround: <a href="http://jsfiddle.net/MrTest/yGBAK/" rel="nofollow">LIVE DEMO</a></p>
