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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:25:55+00:00 2026-06-07T19:25:55+00:00

I would like to figure out a way to retrieve the the link text

  • 0

I would like to figure out a way to retrieve the the link text users click on from within my webapp… i’m wondering if jquery can do it.

Heres what a link would look like:

<span onclick="myfunction();">Link Text 1</span>

The function “myfunction()” is located inside a .js file that gets incluced into the page

When the user clicks on the span tag, I would like to capture the text from the span tag that called the myfunction(), then place the text “Link Text 1” into a js variable I would then use to update my database with.

I know I could do this:

<span onclick="var xx = $(this).text(); myfunction(xx);">Link Text 1</span>

But I have too many calls to this one function that rewriting the click events would be too much…i’m wondering how I can accomplish the same thing from within the “myfunction()” code using jquery to retrieve the text?

Any ideas?

Thanks in advance.

  • 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-07T19:25:56+00:00Added an answer on June 7, 2026 at 7:25 pm

    try this:

    <span>Link Text 1</span>
    

    $('span').click(function(e){
       var txt = $(this).text() // gets span's text
    })
    

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

Sidebar

Related Questions

I couldn't figure out that from SASS documentation. For example I would like to
I am using the XtraNavBar from DevExpress and I would like to figure out
I am a TDD newb and I would like to figure out how to
I know almost nothing about cryptography, but I would like to figure out how
I would like a .htaccess rewrite rule, but I can't figure out how to
I'm trying to figure out if there's a way to retrieve the (full) sql
I would like to figure out how to save a bitmap or vector graphics
<a href=#>Domain name<span class=value>2</span></a> I would like to retrieve only the text Domain name.
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
Would like a for loop in jquery so that: For every hover_link: show hidden

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.