Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JS get dropdown value

let selectedIndex = element.selectedIndex;
if (selectedIndex > -1) {
  let selectedOption = element.querySelectorAll('option')[selectedIndex];
}
Source by careerfoundry.com #
 
PREVIOUS NEXT
Tagged: #JS #dropdown
ADD COMMENT
Topic
Name
3+9 =