what is wrong with my checkbox in span container?
<p>I have a checkbox within a span container. Using the following code, I can successfully toggle the checkbox when the span tag is click. However, it fails when the checkbox itself is clicked.</p>

<pre><code>    $(function(){
        $("span").click(function(e){
            if ($(this).find("input[name='test']").attr('checked') == true)
            {
                $(this).find("input[name='test']").removeAttr('checked') ;
            }
            else
            {
                $(this).find("input[name='test']").attr('checked', 'checked') ;
            }
        }) ;

    }) ;
</code></pre>

<p>Why is this happening? How can I solve this?</p>
