Agustin Agustin - 8 months ago 23
jQuery Question

Selecting ONLY the Text of a Link with jQuery

I am trying to do something which is probably very simple but have yet to manage to figure out. In the following code I am trying to select the text within the link that reads "View Listing" WITHOUT altering the link itself.

I am doing this for translation purpose to change "View Listing" to "Ver Listado"

<div class="listing post-537">
<div class="listing-wrap">
<a class="button btn-primary more-link" href="">View Listing</a>

So far I've success tranlasting parts of this with:

$( "li span:contains('Beds')" ).text("Recamaras: ");

But I do not know how to do it when there is an 'a' tag in the middle.
What to do?

This is wordpress and I have my reasons for doing it with jQuery and NOT in the php files. Thanks.


This will work.

 $( "a.more-link:contains('View Listing')" ).text("Recamaras: ");