I\'ve currently got a script that\'ll check for the value of a select box, and then enable a text field right next to it, and then hopefully set focus.
I have this a
I think that your problem might be that it's not possible to set the focus to a disabled input control (at least in some browsers/operating systems).
Your focus()
call is basically in the wrong block - it should be in the else
block, not the if
block.
Like this:
$("#assessed select").change(function () {
if($(this).val() == 'null') { $(this).next('input').attr("disabled", true); }
else { $(this).next('input').removeAttr("disabled"); $(this).next('input').focus(); }
});