I need to disable a checkbox when a user enters text into a text area, otherwise it would be active. I have tried most relevant events but I can't get it to work. onkeydown disables for the first press and onchange will work if the user enters something then deletes it. Nothing seems to disable it after they leave the text area.
<script type="text/javascript">
function enable_cb(textarea) {
if ($(textarea).val() != "" ) {
$("input.cmb").removeAttr("disabled");
}
else {
$("input.cmb").attr("disabled", true);
}
}
</script>
Comments:<br />
<p><textarea name="issue" id="issue_ta" cols="50" rows="10" class="help" tabindex="2" title="Enter Detailed Description" onchange="enable_cb(this);"></textarea></p>
<p><input name="no_issue" type="checkbox" id="no_issue" class="cmb" />No Issues to Report</p>
<p class="label">Enter Current Vehicle Mileage:</p>
<p><input type="tel" name="record_mileage" class="required" tabindex="3" title=" Enter Current Mileage " size="25"/></p>
<p><input type="submit" name="Submit" value="Send"/></p>
</form>