radio button to enable form fields
<p>I have a form containing two radio buttons, I want to enable corresponding fields when a radio button is checked. My code just isn't working, here it is:</p>

<pre><code>&lt;head&gt;
&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;          
&lt;script type="text/javascript"&gt;
$(document).ready(function() {

    var $type = $('select'),
        $field1 = $("#fieldID1"),
        $field2 = $("#fieldID2");

    $type.change(function() {

        var isDisabled = ($type.filter(":checked").val() === "1");

        $field1.prop("disabled", !isDisabled);
        $field2.prop("disabled", isDisabled);

    }).change();
});
&lt;/script&gt;
&lt;/head&gt;
</code></pre>

<p>My html body is like:</p>

<pre><code>&lt;body&gt;

&lt;form action="" method="post"&gt;

&lt;input type="radio" name="select" value="1" /&gt;
&lt;input type="text" name="fieldID1" id="fieldID1"/&gt;

&lt;input type="radio" name="select" value="2" /&gt;
&lt;table id="fieldID2"&gt;
    &lt;tr&gt;...&lt;/tr&gt;
    &lt;tr&gt;...&lt;/tr&gt;
    ...
&lt;/table&gt;

&lt;input type="submit" value="Add"&gt;
&lt;/form&gt;
&lt;/body&gt;
</code></pre>

<p>I referenced the code from <a href="http://stackoverflow.com/questions/6036635/improving-use-of-radio-buttons-to-enable-disable-form-fields">this post</a>. Can anyone point me out what the problem is, I am not quite familiar with jQuery, thanks!</p>

<p>Still cannot be fixed...</p>
