-1

Here is my select option html code

<select id="font">
        <option value="School">School</option>
        <option value="'Ubuntu Mono'">SansitaOne</option>
        <option value="Tangerine">Tangerine</option>
        <option value="Inconsolata">Inconsolata</option>
    </select>
    <button id="drop">Display</button>

And here is my javascript

<script type="text/javascript">
      $('#drop').click(function(event) {
            what to do here...
  });
    </script>

Any help would be appreciate! Thank in advance

Lina Tum
  • 7
  • 4

1 Answers1

2

Maybe take a look at following : http://www.w3schools.com/jsref/prop_select_selectedindex.asp

you should be able to do :

$('#drop').click(function(event) { var x = document.getElementById("font").selectedIndex; var y = document.getElementById("font").options; alert("Index: " + y[x].index + " is " + y[x].text); });