I have a drop down list that fetches values from db as follows
$.get(\'/getJobs\', function (jobs) {
seljobs = jobs;
var i = 0;
jobs.forE
Try this
on change event
$("#jodSel").on('change',function(){
var getValue=$(this).val();
alert(getValue);
});
Note: In dropdownlist
if you want to set id,text relation from your database then, set id as value in option tag, not by adding extra id
attribute inside option its not standard paractise though i did both in my answer but i prefer example 1
HTML Markup
Example 1:
Example 2 :
Jquery:
$("#example1").on('change', function () {
alert($(this).val());
});
$("#example2").on('change', function () {
alert($(this).find('option:selected').attr('id'));
});
View Demo : For example 1 & 2
Blog Article : Get and Set dropdown list selected value with Jquery
My Blog : jQuery tutorials