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">
<a href="/sc/index.php/home">home</a>
<a href="/sc/index.php/announcements">announcements</a>
<a href="/sc/index.php/contact">contact us</a>
<a href="/sc/index.php/products">products</a>

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

Thank you.
Who is Participating?
leakim971Connect With a Mentor PluritechnicianCommented:
test page :
using :
$(" li:contains('contact us') a").text('open ticket');

Open in new window

tomcattyyAuthor Commented:
I have also tried to  add alert box for

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

and it is blank, hope this helps for troubleshoot.
tomcattyyAuthor Commented:
Thanks for the quick response.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.