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

  • Home
  • SEARCH
  • 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 131275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:04:47+00:00 2026-05-11T06:04:47+00:00

I have a select box with options in it. The value of the options

  • 0

I have a select box with options in it. The value of the options gets the id of the item that is displayed in each option.
I do have an other value that should be linked on this option. Is there an easy way to do this?

<select id='category' name='data[cat]'> <option value='12' label='0'>A</option> <option value='7' label='0'>B</option> </select> 

I tried to do this with entering the second value into a label attribute but then the problem is that I don’t know the correct way to get the label value of the selected option. This is written in jQuery.

To get the selected option I use:

$('#category').livequery('change', function () {                   var catId = ($(this)[0].value);  }); 

This works great, but I just don’t know how to get the label value of the selected option. Or maybe a better way to solve this problem.

  • 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. 2026-05-11T06:04:47+00:00Added an answer on May 11, 2026 at 6:04 am

    The label attribute is used by some browsers to display the content of the option, so your list box might display two 0 options.

    A better solution might be to do the following:

    <select id='category' name='data[cat]'>     <option value='12,0'>A</option>     <option value='7,0'>B</option> </select> 

    and split the value in the event handler, e.g.

    $('#category').livequery('change', function () {                 var values = ($(this)[0].value).split(',');     var catId = values[0];     var otherId = values[1]; }); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a select box, created in the following way: <select id=size onchange=location=this.options[this.selectedIndex].value; name=size>
I have a classic HTML select box: Show: <select name=show id=showThreads> <option value=all selected=selected>All</option>
When I have simple drop down box <select id=fruits> <option value=apple>Apple</option> <option value=orange>Orange</option> <option
I have a select box that needs to submit it's value to a server
I have a select box that gets generated dynamically. I want to allow users
I have a select box that gets cloned. I want to remove the user's
I have a select box. <select id='x'> <option value='1'>'Vineet'</option> <option value='2'>'Vivek'</option> <option value='3'>'Madhu'</option> </select>
I have a select box that shows 3 options: option1, option2, option3. When a
I have a select box that should be populated only when clicked. The query
I currently have a HTML select box like below. <select name=item_1> <option value=0>Choose one...</option>

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.