jQuery get select option id and change hidden input value

前端 未结 3 2026
长情又很酷
长情又很酷 2020-12-31 15:56

I have a form with a select list. Each option also contains a dynamic id, which I need to capture and then use that to change a hidden input\'s value. So basically take the

3条回答
  •  忘掉有多难
    2020-12-31 16:33

    $('#size').change(function(){
       var id = $(this).find(':selected')[0].id;
       $('#changevalue').val(id);
    })
    

提交回复
热议问题