JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 21st, 2012, 09:44 AM
Nullified's Avatar
Nullified Nullified is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 159 Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 19 h 23 m 37 sec
Reputation Power: 30
Lightbulb [Solved] Strip string from several list item hyperlinks

I have a list with list items. some of the list items have hyperlinks and some have images. the ones that have hyperlinks have the name attribute set to topLink. I am trying to adjust the anchor text to strip out a string. It's not quite working as planned. I understand why, but don't know another way to cycle through each one:

Code:
// This just changes the anchor text for all list items to the combined anchor text (normal for the behavior of the reference)
$("li[name=topLink] a").text($("li[name=topLink] a").text().replace("String",""));

//This does nothing as nothing is inside of .text() but I tried anyways as a possible alternative
$("li[name=topLink] a").text().replace("String","");

Last edited by Nullified : September 21st, 2012 at 09:49 AM. Reason: Resolved

Reply With Quote
  #2  
Old September 21st, 2012, 09:49 AM
Nullified's Avatar
Nullified Nullified is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 159 Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 19 h 23 m 37 sec
Reputation Power: 30
[RESOLVED]:
Code:
$("li[name=topLink] a").each(function() {$(this).text($(this).text().replace("<?php print $site->phrase['web_hosting']; ?> ",""));});
Comments on this post
Kravvitz agrees: Congrats on finding the solution and thanks for posting it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > [Solved] Strip string from several list item hyperlinks

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap