Table Maker3schools TranslateImage CompressorFavicon Icon GeneratorCrop & Resize Image
Apu
Apu September 13, 2022 . #Attribute . #HowTo

How to get dropdown selected value in jQuery by class

In this article, you will learn how to get selected value of dropdown in jQuery by class attribute.

Demo : get selected value of dropdown using class.
<select class="my-element">
  <option>Drop down 1</option>
  <option>Drop down 2</option>
  <option>Drop down 3</option>
  <option>Drop down 4</option>
</select>
<script>
$(".my-element").change(function(){
  let myValue = $(this).val();
  alert(myValue);
})
</script>
Try it Yourself »
save
listen
AI Answer
Write Your Answer
loading
back
View All