Get the selected option id with jQuery

前端 未结 4 937
孤独总比滥情好
孤独总比滥情好 2020-12-02 10:31

I\'m trying to use jQuery to make an ajax request based on a selected option.

Is there a simple way to retrieve the selected option id (e.g. \"id2\"

4条回答
  •  情深已故
    2020-12-02 10:44

    Th easiest way to this is var id = $(this).val(); from inside an event like on change.

提交回复
热议问题