Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8095143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:01:27+00:00 2026-06-05T21:01:27+00:00

I have a listbox on a page: <select id=user_list name=user_list size=21 style=width:200px;> <option value=1>User

  • 0

I have a listbox on a page:

<select id="user_list" name="user_list" size="21" style="width:200px;">
  <option value=1>User 1</option>
  <option value=2>User 2</option>
  <option value=3>User 3</option>
  <option value=5>User 5</option>
  <option value=6>User 6</option>
</select>

And if I select a item I can get the current value by using the following code:

var el = document.getElementById("user_list");
var val = el[el.selectedIndex].value;
alert(val);

However, the problem I am having is that I want to be able to search the user_list (start from 1) for the next avaliable number (in my example above it will alert 4, as that is missing)

But I have tried using:

var el = document.getElementById("user_list");
var val = el[4].value;
alert(val);

but it doesn’t work, does anyone know what I am doing wrong?

My guess is that var val = el[4].value; is wrong.. ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:01:29+00:00Added an answer on June 5, 2026 at 9:01 pm

    it works well.
    http://jsfiddle.net/ubpn7/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my process, I have a page that the user can select various items
I have a ListBox in a WPF Page each Item of which consists of
I have the following listbox on my page: <ListBox Grid.Row=1 Name=SlideSelectorListBox SelectedItem={Binding SelectedSlide} SelectedIndex={Binding
I have an aspx page with 5 listboxes. Each listbox can filter the other
I have a list box in my page.. <td><%=Html.ListBox(listServiceTypes, Model.ServiceTypeListAll, new { style =
I have an asp:ListBox control on my web page. I am trying to select
I have a web page with 2 listboxes (HTML select control). The first listbox
on my page, I have a listbox in an update panel. I am successfully
I have a website in c#, in the first page I have some listbox,
I have an ASP.NET page with a listbox whose selection mode is set to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.