tomcattyy
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/announ cements">a nnouncemen ts</a>
</li>
<li>
<a href="/sc/index.php/contac t">contact us</a>
</li>
<li>
<a href="/sc/index.php/produc ts">produc ts</a>
</li>
</ul>
What I have tried but not successful.
$('ul.menu li:contains('contact us')').val('open ticket');
Thank you.
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">
</li>
<li>
<a href="/sc/index.php/announ
</li>
<li>
<a href="/sc/index.php/contac
</li>
<li>
<a href="/sc/index.php/produc
</li>
</ul>
What I have tried but not successful.
$('ul.menu li:contains('contact us')').val('open ticket');
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the quick response.
ASKER
alert($('ul.menu li:eq(2)').val());
and it is blank, hope this helps for troubleshoot.