How to get $(this) selected option in jQuery?

后端 未结 9 1208
青春惊慌失措
青春惊慌失措 2020-12-13 01:18

The following code works:

$(\"#select-id\").change(function(){
  var cur_value = $(\'#select-id option:selected\').text();
  . . .
});

How

9条回答
  •  醉梦人生
    2020-12-13 01:47

    It's just

    $(this).val();
    

    I think jQuery is clever enough to know what you need

提交回复
热议问题