?
Solved

Change the li content with jquery

Posted on 2013-01-21
3
Medium Priority
?
199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Author Comment

by:tomcattyy
ID: 38803070
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 2000 total points
ID: 38803562
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
ID: 38803724
Thanks for the quick response.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

650 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