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 5987835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:52:21+00:00 2026-05-22T22:52:21+00:00

I know how to get the attributes of an element, using jquery. But I’m

  • 0

I know how to get the attributes of an element, using jquery. But I’m not sure how to do it with the actual options in a select field.

<select referenceID="55" name="test" id="test">
  <option value="1">first option</option>
  <option value="2">second option</option>
  <option value="3">third option</option>
</select>

To get the referenceID I would just do this:

$("#test").attr("referenceID");

And when I want to get the value:

$("#test").val();

But I want to get a little more interesting. I want to put some specific info into each option:

<select name="test" id="test">
  <option value="1" title="something here"*>first option</option>
  <option value="2" title="something else here">second option</option>
  <option value="3" title="another thing here">third option</option>
</select>

Is it possible to grab an attribute within the options tags?

I intend to have an onselect function that reads the title tag, and does helps me with some other things.

  • 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-05-22T22:52:22+00:00Added an answer on May 22, 2026 at 10:52 pm

    Presuming you want to find the title attribute of the selected option…

    $('#test option:selected').attr('title');
    

    That is, find the descendant element of #test that is (a) an option element and (b) is selected.

    If you already have a selection containing #test, you can do this with find:

    $('#test').find('option:selected').attr('title');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using LINQ to XML to take some data from resources , and
I am trying to learn XML and I know this is a problem with
I would like to know, in the Page Load event of my MasterPage.Master which
I need to add many entries to my web.config file for many websites. I
I'm creating a pipe that basically needs to follow the work flow as follows:
I'm trying to generate XML that will output the structure and data of any
I am trying to serialize image into XElement and afterwards deserialize it for further
The some part of the html of the webpage which I'm testing looks like
I have a form that outputs systems assigned to a project. The systems are
I just had to switch from ICEFaces dataTable to simple forEach tag, because I

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.