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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:28:40+00:00 2026-06-16T05:28:40+00:00

I am trying to find out what values the users pick for my element.

  • 0

I am trying to find out what values the users pick for my element.

in my variable var1. it contains.

<select>
   <option value='1'>1</option>
   <option value='2'>2</option>
   <option value='3'>3</option>
</select>

<input type='text'>
<input type='text'>
<input type='text'>

I can just do var1.value to get the user selected value.

However, I have another var2 showing

<div>
  <a href='#' id='1'>test1</a>
  <a href='#' id='2'>test2</a>
  <a href='#' id='3'>test3</a>
</div>

I want to get the selected id from the <a>
I am not sure how to get it.

Does anyone has an idea? Thanks a lot.

  • 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-16T05:28:41+00:00Added an answer on June 16, 2026 at 5:28 am

    I’m not sure if this is what you want, but if you want to get id of clicked anchor tag then use this:

    $('a').click(function() { alert(this.id); });
    

    You may want to use this version (just give your div your-div-id id):

    $('#your-div-id').on('click', 'a', function(event){
        alert(this.id);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to find out if a string value EndsWith another string. This 'other
I am trying to find out how to read the value of my WPF
I am trying to return a variable with values of an array of users.
Trying to find out if it's possible to use SQLAlchemy on Heroku. Thanks.
I trying to find out the visibility of the Excel and do some activities
I am trying to find out how to write an SQL statement that will
i m trying to find out how to convert timestamp date and time (
I am trying to find out a way to set a time tag to
I am trying to find out if an instance of an application (not vb.net)
I'm trying to find out how to change the icon of a JStree node

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.