title: hot to get the selected text and selectedIndex in select?
body: <p>I need to get the selected text and selectedIndex in dropdown on submit..The below code returns the first index always 0 with the first option text..for example if i selected three,it shows 0 index and one text...</p>
  
  <pre><code>function myfunc()
   {
      `enter code here`var x = document.getElementById("listt").selectedIndex;
      var y = document.getElementById("listt").options;
      alert("Index: " + y[x].index + " is " + y[x].text);
  }
   &lt;select id="listt" &gt;
     &lt;option &gt;one&lt;/option&gt;
      &lt;option &gt;two&lt;/option&gt;
       &lt;option&gt;three&lt;/option&gt;
       &lt;option &gt;four&lt;/option&gt;
      &lt;/select&gt;
  
  &lt;input type="Submit" value="submit " name="Submit" onclick="myfunc()"&gt;&lt;/input&gt;
  </code></pre>