Get last selected value of multiple select element

前端 未结 4 999
渐次进展
渐次进展 2021-01-05 01:38

I have a number of select boxes that have been set to accept multiple values. Is there anyway that I can use jQuery to get the last selected value? I\'ve tried using the f

4条回答
  •  悲&欢浪女
    2021-01-05 01:58

    Use the :last selector:

    var latest_value = $("option:selected:last",this).val();
    

    It may be that this in the context of the callback function doesn't refer to the

    提交评论

提交回复
热议问题