<select> how to get id of selected item?

Hello experts!

I have <select> list populated dynamically:

<select id="feat1" name="feat1" title="feat1">
@foreach (var p in featQuery)
  counter=counter + 1;
  <option id="@counter">@p.Name</option>

How can I retrieve id number of option selected by user?

To get a option I use:

value = Request.Form["feat1"];

But I do not need string, I need id here.

Thank you

Who is Participating?
Its really very simple. Try this Jazascript code

var x=document.getElementById("feat1").selectedIndex;
panJamesAuthor Commented:
Forgot to mention: it needs to work/ cooperate with WebMatrix code.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.