Click Check Box to Enable Form Input

by Colin Soderstrom

HTML

<form name="form1">
<div class="controlset-pad">
    <input type="checkbox" name="others" id="medium" />
</div>

<div class="field4">
    <label>Click the check box to enable the input</label><br />
    <input type="text" name="other_name" class="medium" disabled="disabled" />
</div>
</form>

JavaScript

$("#medium").click(function() {
    $(".medium").attr("disabled", !this.checked); 
});