• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

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.
0
tomcattyy
Asked:
tomcattyy
  • 2
1 Solution
 
tomcattyyAuthor Commented:
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.
0
 
leakim971PluritechnicianCommented:
test page : http://jsfiddle.net/D2qnZ/
using :
$("ul.menu li:contains('contact us') a").text('open ticket');

Open in new window

0
 
tomcattyyAuthor Commented:
Thanks for the quick response.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now