DynamicsNinja
DynamicsNinja

Reputation: 177

Getting innerHTML from object via jQuery selector

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.

Upvotes: 0

Views: 39

Answers (2)

Anthony Barahona
Anthony Barahona

Reputation: 11

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>

Upvotes: 1

tymeJV
tymeJV

Reputation: 104775

Get the text

$("ul#userDropDown li:eq(2) a").text();

Upvotes: 2

Related Questions