Adding a new item to an unordered list using jQuery with no IDs and too many classes

saininja

New Member
I need to use a custom.js override file to add a new link to an unordered list on three pages. I must use jquery, per the systems requirements, and finding a way to select and insert is really numbing my brain.Here is the menu block itself:\[code\]<div class="nav-block nav-block-logo"> <div class="nav-block-body"> <div class="nav-block-content"> <div class="logo"> <a href="http://stackoverflow.com/"><img src="http://stackoverflow.com/questions/12786287/logo.png"></a> </div> <h2>Contact Us</h2> <ul> <li class="active"> <a href="http://stackoverflow.com/contact-us/">Overview</a> </li> <li> <a href="http://stackoverflow.com/contact-us/contact-us">Contact Us</a> </li> <li class="last-child"> <a href="http://stackoverflow.com/contact-us/facilities-and-directions">Facilities & Directions</a> </li> </ul> <a href="http://www.addthis.com/bookmark.php" class="bookmark-share addthis_button">Bookmark & Share</a> </div> </div></div>\[/code\]I need to add a new li link at the end. I've tried after() and append(), and neither have worked. I was told I may need to target the h2 and check to see if the title is "contact us" or not. Not sure how to do this either.I am relatively new to jquery, and this was kinda dumped on me at last minute. Any help would be greatly appreciated!
 
Back
Top