私は現在、選択ボックスの値をチェックし、そのすぐ隣にあるテキスト フィールドを有効にして、できればフォーカスを設定するスクリプトを作成しました。
現時点では、入力フィールドを有効にするのに問題なく動作するこれがあります...
$("#assessed select").change(function () {
if($(this).val() == 'null') { $(this).next('input').attr("disabled", true); }
else { $(this).next('input').removeAttr("disabled"); }
});
正直なところ、「フォーカス」ビットに少しこだわっています。「$(this).next('input').focus();」を試しました。Javascriptエラーも発生しませんでしたが、それはまったく焦点を合わせませんでした...
$("#assessed select").change(function () {
if($(this).val() == 'null') { $(this).next('input').attr("disabled", true); $(this).next('input').focus(); }
else { $(this).next('input').removeAttr("disabled"); }
});
アイデアはありますか?私は本当にこれにこだわっています。それは非常にシンプルですが、私が構築しているページへの非常に便利な追加です!
ありがとう