[Solved] Strip string from several list item hyperlinks
Discuss [Solved] Strip string from several list item hyperlinks in the JavaScript Development forum on Dev Shed. [Solved] Strip string from several list item hyperlinks JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
Posts: 159
Time spent in forums: 19 h 23 m 37 sec
Reputation Power: 30
[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","");