Tags
Asked 3 years ago
19 Jul 2021
Views 429
Taryn

Taryn posted

How to get jQuery dropdown value onchange event

How to get jQuery dropdown value onchange event
eclipse-learner

eclipse-learner
answered Jul 19 '21 00:00


$('select').change(function(){
var val =$(this).val();
console.log(val)
})


you will get the value selected option text

$('select') will apply to all select box

if you have class or id for speicif select box , you can do this way


$('.classname').change(function(){
var val =$(this).val();
console.log(val)
})




$('#classname').change(function(){
var val =$(this).val();
console.log(val)
})
Post Answer