Enable/Disable Input based on selection (jQuery)
- by Nimbuz
<select name="state" class="select" id="state">
<option value="something">Something</option>
<option value="other">Other</option>
</select>
<input type="text" name="province" class="text" id="province" />
jQuery
$('#state').change(function () {
if ($('#state Other:selected').text() == "Other"){
$('#province').attr('disabled', false);
alert(1);
} else {
alert(2);
}
});
Doesn't seem to work. I must be doing something wrong.