Get text from anchor tag

Use .text() for this:

alert($(this).text());

If you wanted the markup (.text() removes tags and such), use .html()

alert($(this).html());

In this case there’s no difference, if instead you had this:

<a href="http://www.google.com/">Google <span>(External)</span></a>

Then there would be:

$(this).text() //"Google (External)"
$(this).html() //"Google <span>(External)</span>"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)