Answers for "show selected option in select box"

0

selected dropdown value

Plain JavaScript:
===================
var e = document.getElementById("elementId");
var value = e.options[e.selectedIndex].value;
var text = e.options[e.selectedIndex].text;
---------------------------------------------------------
jQuery:
=======
$("#elementId :selected").text(); // The text content of the selected option
$("#elementId :selected").val(); // The value of the selected option
Posted by: Guest on July-17-2020
0

how to show selected value in select box using jquery

$('selector').val(value);
Posted by: Guest on April-12-2021

Code answers related to "show selected option in select box"

Browse Popular Code Answers by Language