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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:48:38+00:00 2026-06-01T06:48:38+00:00

simple bit of jquery. I have a div with clss linklist, inside it has

  • 0

simple bit of jquery. I have a div with clss linklist, inside it has several linkbuttons

<script type="text/javascript">
            $(function () {

                $('#linklist a').each(function () {
                    alert(this.text);
                });
            });
</script>

I would assume that it should alert the text inside each rendered hyperlink. instead I am getting the value “undefined”

if i change it to

alert(this.id);

i am getting the correct client id – therefore i know at least that I am selecting correct.
why is this value undefined? same goes for this.text and this.value

Thanks

  • 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-01T06:48:40+00:00Added an answer on June 1, 2026 at 6:48 am

    this inside the event handler is the native DOM element.

    When you do this.id you are getting the id property of the DOMElement (an anchor). But it does not have a text property.

    To get the text of the anchor, use:

    // turn "this" to a jquery object and use .text()
    $(this).text()
    

    Or staying native javascript, you can:

    this.textContent || this.innerText
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of javascript/jQuery which creates a simple slideshow. I'm learning jquery
I have a simple bit of jQuery which displays the row below the current
I have a very simple bit of jQuery to retrieve my latest Tweet $.getJSON(http://twitter.com/statuses/user_timeline/username.json?count=1,
I have written a simple jquery script for a content slider. My problem is
I have a very simple bit of code (relies on jQuery): var dom_builder =
I have a very simple bit of code that is supposed to capture the
My problem is a bit more complex than using the following simple JavaScript code:
I have a basic page, with a div containing text, and a form to
I'm trying to get the hang of jQuery and I had this simple bit
I'm tinkering a bit with jquery to show a hidden div when a link

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.