vendredi 27 juin 2014

jQuery change innerHTML of link based on href


Vote count:

0




I have the following html generated by a CMS for a tabbed element:



<li class="active" style="width: 233px;">
<a href="#tabopen_tickets">Open Tickets</a>
</li>


I want to change the link's text of "Open Tickets" to other text, but I only know the link's href.


How can I do this with jQuery? Thanks!



asked 1 min ago


2 Answers



Vote count:

1




You can use:



$('li.active a').text("new text here");


answered 23 secs ago



Vote count:

0




Try



$('a[href="#tabopen_tickets"]').text('Changed');


answered 20 secs ago





Aucun commentaire:

Enregistrer un commentaire