html
1<td> 2 <select name="message[]" class="info_sel"> 3 <option value="0"selected>なし</option> 4 <option value="1">あり</option> 5 </select> 6</td> 7<td class="day"> 8 <input type="text" name="hoge" class="text"> 9</td>
javascript
1$(function () { 2 $(".info_sel").change(function () { 3 var info_sel = $(this).val(); 4 if(info_sel == 0){ 5 $(this).next().children(":text").attr("disabled","disabled"); 6 }else{ 7 $(this).next().children(":text").removeAttr("disabled"); 8 } 9 }); 10 });
上のカラムがforeachで複数出力されているのですがこのセレクトボックスで「なし」を選択したらとなりのinputをdisabledにしたのですがうまくいきません。。
どなたか教えてください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/08 11:26
2018/02/08 11:31
2018/02/08 11:47
退会済みユーザー
2018/02/08 11:49
2018/02/08 11:59
2018/02/08 12:00 編集
2018/02/09 00:10 編集
退会済みユーザー
2018/02/08 12:10
2018/02/09 00:07