Find name of selected option using jQuery

前端 未结 4 945
囚心锁ツ
囚心锁ツ 2021-02-04 01:21

I\'ve made a jquery/ajax function that updates #courses, sending #fos\'s .val() and .text(), specifically of the one that is selected, like so:

$(\'#selling #fos         


        
4条回答
  •  感动是毒
    2021-02-04 02:04

    This should work:

    $("#"+$(this).attr("id")+" :selected")
    

    it's not pretty but it does the trick :)

    or this will work:

    $(this).find(":selected").text()
    

提交回复
热议问题