0

This is an example,

<select>
    <option value=1>Cars</option>
</select>

How i can get the value of selected "1" and value in list box "Cars"?

Angripa
  • 159
  • 2
  • 4
  • 14
  • I believe that you have to use either submit a form or use some Javascript in order to access those values. Check out [this answer](http://stackoverflow.com/a/1085810/1911676) for an idea of how to use Javascript to get the values you want. – Enigmadan Jul 13 '13 at 08:27

2 Answers2

3

try out this

<select id="selectID">
    <option value=1>Cars</option>
</select>

using javascript

var e = document.getElementById("selectID");
var strUser = e.options[e.selectedIndex].value;
Vijay
  • 7,651
  • 9
  • 41
  • 69
2
jQuery("#sltbox").find("option[value=1]").attr("selected","selected")

Give id as sltbox to your select tag.

Mr. Alien
  • 147,524
  • 33
  • 287
  • 271
Jay Shukla
  • 5,646
  • 7
  • 29
  • 59