how to hide textbox when the front checkbox is unchecked using jQuery
<p>I have a function that is used to hide/show textbox right after the checkbox, it works very well untill one day I changed the checkgroup to radiobutton group.
The function that I use is like this</p>

<pre><code>var U={
HideOptions: function() {
    $(".option").each(function() {
        if ($(this).closest("li").find(".extra").length) {
            if ($(this).find("input").is(":not(:checked)")) $(this).closest("li").find(".extra").hide();
            $(this).find("input").change(function() {
                $(this).closest("li").find(".extra").toggle().find(".checkgroup .extra").each(function() {
                    $(this).hide();
                    if ($(this).closest("li").find(".option input").is(":checked")) $(this).show();
                });
            });
        }
    });
},
ChangeToRadio: function(selector) {
    var $checkbox = $("input[name=" + selector + "]");
    $checkbox.click(function() {
        if ($(this).attr('checked')) {
            $checkbox.removeAttr('checked');
            $(this).attr('checked', true);
        }
    });
  }
}
</code></pre>

<p>My html structure is like this</p>

<pre><code>&lt;ul class="checkgroup&gt;
    &lt;li&gt;
        &lt;div class="option"&gt; 
             &lt;input id="abc" type="checkbox" value="0" name="chk"&gt;Yes
        &lt;/div&gt;
        &lt;div class="extra"&gt;&lt;input id="abc1"  type="text" value="" &gt; &lt;/div&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;div class="option"&gt; 
             &lt;input id="edf" type="checkbox" value="1" name="chk"&gt; No   
        &lt;/div&gt;
        &lt;div class="extra"&gt; &lt;input id="edf1"  type="text" value="" &gt; &lt;/div&gt;
    &lt;/li&gt;
    ....
 &lt;/ul&gt;

 &lt;script type="javascript"&gt;
       U.HideOptions();
       U.ChangeToRadio("chk");
 &lt;/scripot&gt;
</code></pre>

<p>Typically, there are several <li> in , After I use ChangeToRadio function, I found the HideOptions does not works very well. For example, the "extra" part will not be hide if you check other "option". </p>

<p>Any idea?</p>
