what this code doesnt work in Jquery 1.7 and up
<p><strong>this code works in jQuery, ver. 1.6</strong></p>

<pre><code>&lt;input type="checkbox" class="radio" value="1" name="sameName" /&gt;
&lt;input type="checkbox" class="radio" value="1" name="sameName" /&gt;
&lt;input type="checkbox" class="radio" value="1" name="sameName" /&gt;

$("input:checkbox").click(function() {
    if ($(this).attr("checked") === true) {
        var group = "input:checkbox[name='" + $(this).attr("name") + "']";
        $(group).attr("checked", false);
        $(this).attr("checked", true);
    } else {
        $(this).attr("checked", false);
    }
});​
</code></pre>

<p>BUT if I change the code using new methods of jQuery 1.7 it wont work? why? thanks for yr time :</p>

<pre><code>$("input:checkbox").on('click', function() {
    if ($(this).attr("checked") === true) {
        var group = "input:checkbox[name='" + $(this).attr("name") + "']";
        $(group).attr("checked", false);
        $(this).attr("checked", true);
    } else {
        $(this).attr("checked", false);
    }
});​
</code></pre>
