#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    159
    Rep Power
    31

    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 10:49 AM. Reason: Resolved
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    159
    Rep Power
    31
    [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.

IMN logo majestic logo threadwatch logo seochat tools logo