jQueryのselect変更イベント時に、selectのhtmlそのものを取り出したいです。
optionのselectedが変更前の状態しか取得できません。
htmlの書換えがchangeイベントの後だからという仕様なのでしょうか?
選択したものがselectedとなっているhtmlを取得する方法はないでしょうか?
jQuery
1 // select変更イベント 2 $(document).on('change','select',function(){ 3 4 // 入力値(ここは変更後の値となっている。予想通りの動作。) 5 var inputval = $(this).val(); 6 7 // selectタグのoptionは、変更前のoptionがselectedとなっている。 8 // 選択したoptionがselectedとなっているhtmlが欲しい。 9 var inputtag = $(this).parent().html(); 10 }
HTMLもご提示ください。
回答2件
あなたの回答
tips
プレビュー