0

I have a problem with getting innerHTML from object that looks like this:

<a class="trackable-user" href="/blame.fic">
    <i class="icon-user"></i>
    #BlameFic
</a>

Got this object by typing $("ul#userDropDown li:eq(2) a"). So my question is what do I need to add to my selector to get #BlameFic from the object that I mentioned.

1
  • Did you resolve the issue? Commented Aug 20, 2015 at 21:11

2 Answers 2

2

Get the text

$("ul#userDropDown li:eq(2) a").text();
Sign up to request clarification or add additional context in comments.

1 Comment

Thx for the fast answer, first day of my JS journey so I'm still confused :D
1

What tymeJV is correct. Use text() to get the value. Here is just another variation:

<script>
$(document).ready(function() {
    var track = $("a.trackable-user").text();

});
</script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.