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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:05:05+00:00 2026-06-16T00:05:05+00:00

this SHOULD be simple, but I have been through the Jquery Selector help for

  • 0

this SHOULD be simple, but I have been through the Jquery Selector help for about an hour now and nothing seems to be working. Help!

I am basically trying to pull the text (an address) of a SPAN after a user clicks on the link next to it. Please note though, I will have about 10 on a page, so I cannot set a static address. It must be pulled when the user clicks.

The html code:

<a href="3" class="clicky">Click to Show Map</a> 
<span style="display: none" class="theaddy">123 Fake Street, Somewhere Else, 12341</span>

So really, my question is, how do I grab the text from .theaddy when a user clicks on .clicky?

As I said, I cannot use

 var propertyaddy = $(.theaddy).text(); 

because there are 10 of these addy’s on the same page. I need some sort of “THIS” > Next To kinda thing.

I also tossed around the idea of placing the SPAN inside the A, but my efforts on that weren’t working either.

Thank you in advance for any help!

  • 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-16T00:05:06+00:00Added an answer on June 16, 2026 at 12:05 am

    You can use .next() to find the next sibling of any element.

    $('.clicky').on('click', function() {
        var text = $(this).next().text();
        ...
    });
    

    So long as your required .theaddy element is always the “next” element there’s no need to give a specific class selector inside the .next() call.

    If there might be other elements in between, you can use .nextAll('.theaddy').first(). This generates a list of all following .theAddy elements, and then takes the first such element.

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

Sidebar

Related Questions

This seems like it should be so simple, but apparently it isn't. I have
This seems like it should be a simple problem but I've been unable to
This should be a simple issue but I can't figure this out. I have
This should be really simple, but I have tried many solutions posted on the
This should be simple, but I'm getting confused. I have a parent/child tables -
This should be quite simple, but I can't work out the syntax. I have
This should be so simple, but I'm drawing a blank. I have two tables.
This should be pretty simple, but I am new at LINQ. I have a
This should be simple task but i am not been able to find the
Seems like this should be super-simple but looking around for a simple (or half-way

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.