Jquery to get the id of selected value from dropdown

前端 未结 4 1369
栀梦
栀梦 2021-02-10 14:32

I have a drop down list that fetches values from db as follows

$.get(\'/getJobs\', function (jobs) {
        seljobs = jobs;
        var i = 0;
        jobs.forE         


        
4条回答
  •  旧巷少年郎
    2021-02-10 15:13

    Try the change event and selected selector

    $('#jobSel').change(function(){
        var optId = $(this).find('option:selected').attr('id')
    })
    

提交回复
热议问题