Select Get Selected Item JavaScript Html Example

<select id="idSelNick">
<option value="neuveden">Neuveden</option>
<option value="hlavni-mesto-praha">Hlavní město Praha</option>
<option value="stredocesky">Středočeský</option>
<option value="jihocesky">Jihočeský</option>
<option value="plzensky">Plzeňský</option>
</select>
 
// in script
var mysel = document.getElementById('idSelNick');
var seltxt = mysel.options[mysel.selectedIndex].text;
var selval = mysel.options[mysel.selectedIndex].value;
This entry was posted in Javascript css html and tagged . Bookmark the permalink.


Comments are closed.



2,958 views