Quick Posting.
HTML
<select class="form-control m-bot15" id="myselect" onchange="getHargaLayanan()">
<option value="1">Text 1</option>
<option value="2">Text 2</option>
</select>
I want get the innerHTLM or the text of the selected option with javascript.
Here is how is that done:
<script>
var elemen=document.getElementById('myselect');
var mytext=elemen.options[elemen.selectedIndex].text;
alert(mytext);
</script>
thats all!!!
Tidak ada komentar:
Posting Komentar