js select option value when selected

Solutions on MaxInterview for js select option value when selected by the best coders in the world

showing results for - "js select option value when selected"
Igor
14 Jun 2016
1<select id="ddlViewBy">
2  <option value="1">test1</option>
3  <option value="2" selected="selected">test2</option>
4  <option value="3">test3</option>
5</select>
6
7<script>
8    var e = document.getElementById("ddlViewBy");
9	var strUser = e.value; // 2
10	var strUser = e.options[e.selectedIndex].text; //test2
11</script>
Leana
25 Aug 2016
1(function() {
2    
3    // get references to select list and display text box
4    var sel = document.getElementById('scripts');
5    var el = document.getElementById('display');
6
7
8    function getSelectedOption(sel) {
9        var opt;
10        for ( var i = 0, len = sel.options.length; i < len; i++ ) {
11            opt = sel.options[i];
12            if ( opt.selected === true ) {
13                break;
14            }
15        }
16        return opt;
17    }
18
19    // assign onclick handlers to the buttons
20    document.getElementById('showVal').onclick = function () {
21        el.value = sel.value;    
22    }
23    
24    document.getElementById('showTxt').onclick = function () {
25        // access text property of selected option
26        el.value = sel.options[sel.selectedIndex].text;
27    }
28
29    document.getElementById('doLoop').onclick = function () {
30        var opt = getSelectedOption(sel);
31        el.value = opt.value;
32    }
33    
34}());
35// immediate function to preserve global namespace
36
queries leading to this page
how to get the select option value in javascriptget selected option from dropdown javascriptjavascript how to set the selected value on a combo boxselect html javascript get valueselect option value in html jsget the option by value and make it selected in javascriptjavascript select selected ajavascript combobox select valuemake option selected based on value javascripthow to get the value of selected html in javascriptjs how to get option value when selectedhow to the value selected in jsvalueinchoice javascriptget select option value by jsvalue in select tag usinh jsget value from select option in javascripthow to access select value in javascriptget selected option select jshow to get select option value in javascripthtml javascript get selected optionvalue of selected option javascriptjavascript get the value of an inpute type optionjavascript selected select valuehtml get selected option for selctselected option select jsjavascript select option selected valuehow to get the value from selected option in javascriptjs get selected elementselect html option value jsjavascript set selected option by valuehow to get select option attribute in javascripthow to select value of option html using javascripthow to get option from select in javascripthow to get value select option by javascripthow to find the selected option value in javascriptjs selected option valuehow to get the value of the selected option in javascripthtml select get optionjavascript take selected from selected taghow to get the value of select option in javascriptselect the option which is selected in jsselect new value ajasvcripthow to set select option selected value in javascriptselect option value with javascripthtml js get select option valuejs select get optionhtml get selectedoption selectedhow to set value to select tag in javascripthtml get selected option jsjs taking option as value selectedjs option selectedjavascript select drop box valueget selected item from select tagselect html selected value javascripthtml javascript select option valueget selected option js htmljavascript select option value selectedgetting the selected option of select option in javascriptjs select selected optionhow to get value of select javascripthow to get the value from a select option using javascriptjavascript select value in dropdownhow to get selected option select javascriptjs get selected value from selectjavascript get selected option valueselected option jsdrop down list js option valueselect option nodejschoose option by value js html get select selected valuejs select option value when selectedhow to get the item selected in select taghow to get selected option from select htmlget selected option htmlhtml select get selectedget option from select javascriptjavascript select optionselect selected value jsget selected value select jsjavascrtip element select option valuehow to get option value in javascriptget value from select option javascriptget selected value of select in javascripthow to print dropdown value in javascriptjs get select selected valuejavascript select option value sethow to get the value of option selected in javascriptjs take value from selectjavascript get current selected optionhtml js change selected optionget current select value javascriptdocument select by id for select valuehow to get the value of a select element in javascriptselect value in select javascript get selected option in select javascripthtml get value of selected optionhtml select javascript get selected valueoption selected value jsjavascript get option from selectget html selected javascripthow to get input from option in htmljavascript get select option valueshtml select option selected jsjavascript find the selected optionoption value selected javascriptget selected select option javascriptjs get value of option selectedget selected element value in select box javascriptget the selected option value in javascriptvalue of select option javascriptdocument select option value javascriptjs get the selected optiondocument getelementbyid dropdown set selected valuehtml dom select selected valueget option value from javascripthtml select how to get the selected valuejs get select selectedselect option value select in jsjavascript select selected valuejs combobox selected valuejs get selected select valuehow to selected option value using javascriptget the value of the selected option javascriptget the option value of a select in javascriptjavascript get selectedhtml js select option 3d valuejs make option selected by jshow to select a dropdown value in javascriptjs get selected item from domjs get option of selectoption select html selectedvalue jshtml js get selected optionhow to get value from select option javascriptjavascript find option selectedhow to get val from select option in jsselect option js valuehow to check which option is selected javascriptvalue select js optionget selected option in dropdown using javascriptjavascript select option selected value sethow to get select selected value in javascriptjavascript get element selected optionjs get select optionselect value findget the selected option value of dropdown in jsjavascript get values from lists of dropdownsget selected option value in javascripthow to get which option was selected in jsjavascript select get selected optionhow to get selected value in javascripthow to get the value of selected option in javascriptselect html option get selected valueget selected value in select htmljavascript select tag selected valueget the select option value in javascripthow to get selected option in select jsjavscript how to get selected option in select boxjavascript access selected optionhtml dom select value selectedget selected value of dropdown in javascriptget selected option id javascriptget selected item using javascipthow to get selected option value in htmljavascript 3a get select field value by idselect option get value javascriptget the value of select option in jsoption value selected in jsget selected from select javscripthow to get html of selected element in jsdom select option valuehow to set value in select option using javascriptjavascript get select option valueget selected value from javascripthow to use javascript to set drop down valuejs get selected htmlget option selected jsjavascript select option select valuejavascript to get value of selected optiondropdown list select element javascriptget option select javascriptjs select option valueget selected value of select tag in javascripthow to grab selected option dom manipulationget html of selected optionselect value select javascriptjs select a select valueget selected option value javascriptgetting the selected option injavascriptget value select option selected jsjavasript option selectedselect option value javascriptget current selected option javascriptjavascript form get selected optionhow to get selected item from select in javascripthow to take value from dropdown in javascripthow to get value selected in select in javascriptget value selected option dropdown javascriptjavascript get value of selectselect box get option value javascripthow get selected value in javascriptjavascript get the value of selected optionjavascript value selected optionjs get value selected optionselect option javascript valuehow to get value of selected option in javascriptjavascrip get selected valuesjavascript option selected by valueget item selected of select tag jshtml get selected optionhow to get selected value from html optionsjs to make selected to option valuejavascrip option select valuejs select box set selected valueget selected value javascriptusing javascript can i get the selected poriton using dom elementjavascript find selected optionjavascript dom get select valuewhen option is selected javascripthow to select value from dropdown in javascriptjavascript get selected valueselect element get selected optionjavascript how to select just the valkuedropdown menu value accessjavascript get the value of the selected select optionselect current value htmljs which option selected by valueget selection from list htmlhow to get selected option jsjavascript get selected option elementjavascript get select optionselect option using javascriptjs to get selected option valuejs how to read the selected optionselected value get using javascriptget select option javascriptselected value in javascriptget selected item javascriptcombo selected value in javascriptjavascript get option selectedget selected value from select javascriptjavascript set select option select valueget selected option in dropdown javascriptget selected options jsjs set option selected valueget selected value select javascripthow to select input value in javascriptselected value select jsjs get selected valuedisplay the slected value option without using id in domhow to select an option value in javascriptselect option by value jsjavascript select selected value gethtml get selected valuejavascript option value selectedselected value from in htmljs get element ame selectedhtml get selected value from selectjs get selected itemchoice value 3b jsget slected option value jsjs get select with selectedhow to get selected options value jsjs selected value optionget option selected input javascript html get selected from selectselect select value jsjs select get selected oprionjavascript set select option selected valueoption selected value javascripthow to get value of select tag in javascriptjs select option based on valueselect option value in jsselected value javascriptoption selected vaue javascriptget values from html selectionhtml select how to get selected valuejs get selectedjavascript get current selected option valueoption select value javascriptget value of option javascriptjavascript select option by valuehow to select selected option value in javascriptget selected value in javascriptjs see what is selected in select taghow to get selected options in javascripthtml get selected option from selectjs get selected values from selectselect selected options jsdisplay the slected value option using id in domdom select get valuejavascript find option selected in selectselect option html javascript get selectedjavascript select option based on valueget selected option value in html element with jsjs when select is selectedhtml option get selected valueget selected option using jsjavascript how to get select valueselect list value in javascriptjavascript get selected optionhow to access selected value of select tag in jsselected method javascriptjavascript get value from select optionhow to get the content of html option in javascriptget input from select htmljs select option 3aselected valuejs make select with value selectedget selection option jsjs select value where option is selectedjavascript get select selected valuejs select options valuegetvalue of selected javascriptjavascript dom get selected option valuehow to get selected value of select option in javascripthtml get selected option javascriptselect selected option javascripthow to get what item is selected in a select javascriptselect option javascriptdisplay selected option in dropdown javascriptget selected option from eventget selected value jsselect option 3aselected jsjavascript get option which selectedselected select option javascriptget value of 3aselectget value of the selected option jsselected option value javascripthow to take selected value through javascript 3fjs select selected selected valuehow to get current option tag in select javascriptget value of selected option jsjs option select valueselect option with value jsget selected value of select jsselect tag selection value jsjs get option from selecthow to reference select option value in javascriptget selected option value jshow to get selected option from select in javascriptget select option values jshow to selected value in select using jsjavascript selected valuejavascript select an option by valuejavascript selected option dropdown select value in javascriptjavascript get selected element in selectgrab the value of a selected option javascripthow to get value from document selectjs select option by valuehow to get the value associated to the selected option in javascriptselection option html get selected valueoption html selected javascriptselect dropdown item javascriptjavascript value of selected optionhow to get selected value of select jsjavascript value of selected itemget value select option javascripthtml select option selected value javascriptget selected element javascriptselect value with javascriptget selected value from select in javascriptselect set selected value javascripthow to get the selected option in select htmlhow to get the html of selected element in javascriptjs select selected optionsdocument getelementbyid option in slelectselect list selected value javascripthow to get the option from a select element javascriptjavascript get selected htmlhtml select option set selected value javascriptget the select option values from javascriptjavascript get selected option of dropdownjavascript how to i grab the option that is selectedjs get selected option valueselect option selected val jsselected value jsselect box selected value in javascriptget selected option from html selectjavascript select option valueselect option by value javascripthow to get selected option label in javascriptget option selected javascripthow to get options selected html javascriptget option of select javascripthow to get selected options value 3fhow to select box selected value in javascriptjavascript get selected elementget selected option of a select javascriptselect selected value javascriptjavascript option selectedget selected item from select javascriptjavascript get selected value from select tagselect value selected javascriptset selected value of dropdown in javascriptdocument select option valueoption value 3d 22 22 selected 3d 22selected 22 jsget selected option in javascriptjs select option with valuejs select option selected valuehow to get selected value from select tag in javascriptget html select selected valuehow to select value from select box in javascriptget selected item htmljavascript this selected option valueselect option value in javascriptjavascript select dropdown option by valueselect selected value javascript how to get the value of a select option in javascriptvalue select in combo but showing not selected in javascriptjavascript how to work with dropdown valuehow to select value on select but value in jsselect js selected valueselect a option using javascript domjavascript get selected html elementmake select option selected javascripthtml select value javascriptjavascript for select option valueoption selected javascriptjavascript to select dropdown valuehtml get selected option valuehow to change select value in javascripthtml select option how to get selected valueget value selected option javascriptretrieve selected option javascriptselected item in javascriptoption selected jsjs getting selectedget select list valuehow to select value on select get value in jsjs which option selectedget selected option jsselected option from javascripthow to select option selected 3d 22selected 22 by javascriptjs html select valuechange selected option javascriptget the value of select option in javascripthtml get dropdown valuehow to get selected dorpdown valuejavascript select menu how to get selected optionselect selected javascript valueget value of option selected javascriptselect get option value jshow to get value select box in javascripthow to get selected item in select htmljs function selected valueget selected from select javascriptjs get selected opitonjavascript html select get selected valuevalue of selected in jshtml dom set option having one value from select as selectedget index value setector javascriptjs when option is selectedget select option value jsget value of option html in jshow to get value from select option in javascriptset select option value javascriptjavascript option selected valuehow to know which option item selected in javascriptget selected value select option javascriptselect option with javascript by valueselect option based on value javascriptselected option in javascriptgetelementbyid dropdown valuehow to set select box selected value in javascriptget selected value in select element javascriptselect a value in a select jsjavascript select get selected valueselection value jshow to get a selected value in javascriptget selected value of select option in javascprithow to get selected option from select in jsget select value javascript select htmljs select select selected valueselect javascript option valuehow to set selected value in select box using javascriptjs choose selected optionhtml select option selected javascriptjavascript select option with valuejs select option selectedjs get selected tget value of select option in javascripthtml select selected javascriptjavascript get value select optionget option selectedget real value select javascriptselected value select javascripthow to specify the selected value of an option in javascripthow to get selected value from select tag in htmlget element selected javascriptselect value from select javascriptjavascript get value of select optionselect value html jsjavascript get select option selected valueget selected option from select javascripthtml select is selected jsselect get selected value if has selectedjs select options selectedget option selected value jsselect option in select javascriptoption value javascript selectedvalue of selected option jshtml select get selected valuehow to get selected item in javascriptjs get input type value on selectselect get selected value javascriptselection javascript in option display the value of selected option in jsobtain info select jshow to get option value of select in javascriptjavascript get each select option valueget the selected optionmake select option value jsjs get selector valueselected option javascriptjs form select vlueselected select option javascripthow to get selected option in select htmldropdown quick selection javascripthow to get select box selected value in javascriptget selected option attribute javascriptjavascript get value of selected optionjavascript get selected tagget selected index of drop down list javascriptget selected option javascripthow to get the selected option in javascriptget the option value from option element of html in javascriptjavascript dom select option selectedhow to get selected option from dropdown in javascripthow to take element select and option value in javascriptjs selected optionjavascript select option selected by valueget element by option valuejavascript get selected option on changejs select selected valuehow to get the selected value of a select element in jaavscripthow to get value of option selected in javascripthtml how to get selected optionselected option with javascripthow to select option from select in jsjs get option selectedoption selected javascripttake select valuejavascript selected option value setjs selected select optionselect selected by jsjs select dropdown option by valuehow to get option value in select jsjavascript select option value by valuehow to select option value in jsget the value of selected option in javascriptjs get selected value of form selectreference selected option from select htmlselected value on javascripthow to show a selected select value in html using javascripthow to select the item selected in select tag javascriptget selected option in select jshow to get selected option value of select in javascriptjavascript selected option valueget selected values jsjavascript get selected tag valuehow to get what option selected value in javascripthow to get selected option valuehow to get html option selected valueget value of select option javascriptjavascript value select optionget value of selected option javascripthow to get the value from a select option in javascriptto to access option valuehtml select get value of selected optionhtml select set selected value javascripthtml select javascript selected valuehow to get the value of an option in select javascriptget value from driopdown list htmljavascript selected set option valuejs get html select option valuehow to get selected element in javascriptget selected value from select dropdown jshow to send value of select element in javascripthow to show a selected select value using javascriptget option values of select jsjavascript get selected learnmake a selected value select using javascriptselect value of option jsjs select get selected option valuehow to check the selected value of dropdown in javascripthow to get the selected option jsselected using javascriptget value from selected option javascripthow to get selected option htmlget selected option html javascripthtml select option get selected valueset selected values of select in jsfind value of selected option javascripthtml select element get selected valuejavascript get selected value from optionget selected tag selected value in jshow to get selected option in javascriptjavascript select get selectedhow to get selected value of options in htmlget value option selected javascriptselect option selected jsjavascript select options value selectedjs select box selected valuehtmlselectelement get selected valueget selected value optionhow to select value in select jsslected select value javascriptjavascript how to get option value from selectjavascript dropdown selectdocument getelementbyid selected optionreturn the value of a select option in jshow to get selected valuue of a select box in javascriptselect option get selected value javascriptget select option value javascriptfind selected option javascriptjavascript how to get select option valuehow to get selected value in select javascripthtml select get value selectedhow to get data by html select option value in javascriptjs select option get selectedhow to get select value javascriptjavascript check get selected optionhow to get selected option from select element in javascripthow to set select option value in javascriptset selected value of select in javascriptjavascript get value selectedgetting the value of select list javascripthow to get the value of a selected option in javascripthow to get selected value from dropdown in javascriptget element selected javascript in selectselect html get selected value selected option in jsjavascript select option value optionsjavascript select this selected valueget item selected select tag jsselection select value jsgive select box selected value javascripthow to select an option element from it 27s value in javascriptget selected value of of select taghtml select selected value javascriptjs get select optionsjavascript get option value from dropdown listhow to get the selected element using jsjs option selected valuehow to change selected option of dropdown in javascriptget currently selected from html select javascripthow to get the selected optionn in jsjavasctipt this option selectedfunction for get selected html elementjs get value of selected optionjavascript get selected option of selectfind selected option in javascripthot to get the value of selected option jshow to find selected option in javascriptjavascript get selected value optiongetting selected option value in javascriptjavascript dropdown menu select valuejavascript get selected element w3js select option value domselected select option valueselected value in jshow to get selected option from sleect html in jsselect option value using js for a selectboxhow to get selected value in select htmljs select an option valueget select box selected value in javascripthow to get the selected value in javascriptvalue select option javascriptget value of select event jsselect tag javascript selected valuejavascript html select get selectedget value from selection menuhow to set selected value of select in javascriptget the option selected in javascripthow to get value of select option in jsjavascript get selectedindex valuehow to grab the selected options element in a select element javascript htmlhow to get the option value of select using javascriptselect input seklected jshtml get option selected valuejavascript select set selected valuehow to select option value in javascripthow to get selected option with javascripthtml select valueget selected option from select jshow to get selected option value to jsselect dropdown javascriptjavascript select selected optionget selected optionselect javascript selected valueget value of drop down list javascriptget select option element jsselected value from javascriptjavascript select element selected valuejs set option selected by valuejs select get selected valuejavascript show selected option valuejavascript select option get optionjs get selected optionhtml javascript option selected valueget the selected option in javascripthow to select the option value in javascriptjavascript get value from selected optionjs get value of selected dropdown itemjs select get selected optionhow to get value of select option in javascriptselect option get selected option elementjavascript select option set selected valueget selected option of select htmlselect option selected javascriptfind the selection in s4elect using jsjavascript function to get selected value option from selectget selected value of select option javascriptget html option selected valueget select option jsjs get selected option from selecthow to select a value in dropdown javascriptjavascript select option selectedselect get selected value jsset select option by value javascriptselect option value using javascripthtml select js get selectedjavascript this option selectedhow to gte the select option value in javascriptgetchzn dropdown value with getelementbyidget selected value html select drop down list javascriptselect options selected javascripthtml select find value javascriptjavascript set select valueselection selected in jsjavascript find value in select optionsjs get selected value selectjavascript dom select option valueselect value in javascriptselect option by value in javascripthow to get selected option value in javascriptget selection using js htmlget option value from select javascriptget selected items from select tag jsjs select option value when selected