Link to home
Start Free TrialLog in
Avatar of tomcattyy
tomcattyyFlag for United States of America

asked on

Change the li content with jquery

Hi there,

I am trying to replace one of the list content with jquery, however it is not working and have error. Please advise what should be done. Appreciate your help.

I try to find the "contact us" list and replace it with "open ticket"

This is the menu:

<ul class="menu">
<li>
<a href="/sc/index.php/home">home</a>
</li>
<li>
<a href="/sc/index.php/announcements">announcements</a>
</li>
<li>
<a href="/sc/index.php/contact">contact us</a>
</li>
<li>
<a href="/sc/index.php/products">products</a>
</li>
</ul>

What I have tried but not successful.
$('ul.menu li:contains('contact us')').val('open ticket');

Thank you.
Avatar of tomcattyy
tomcattyy
Flag of United States of America image

ASKER

I have also tried to  add alert box for

alert($('ul.menu li:eq(2)').val());

and it is blank, hope this helps for troubleshoot.
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the quick response.