Solved

Change the li content with jquery

Posted on 2013-01-21
3
179 Views
Last Modified: 2013-01-21
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
Comment
Question by:tomcattyy
  • 2
3 Comments
 
LVL 1

Author Comment

by:tomcattyy
Comment Utility
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
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
test page : http://jsfiddle.net/D2qnZ/
using :
$("ul.menu li:contains('contact us') a").text('open ticket');

Open in new window

0
 
LVL 1

Author Closing Comment

by:tomcattyy
Comment Utility
Thanks for the quick response.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now