Grow your CSS skills. Land your dream job.

This one is a doozy, lets see if you can solve it. [SOLVED]

  • # February 16, 2010 at 1:11 am

    The goal is to take an unordered list of websites, like the following:

    Code:
    • website.com
    • website2.com
    • website3.com
    • website4.com

    And wrap them in a link.

    Too easy? ha ha, not done!

    I also want it to add a href="http://" with that link.

    Still too easy? Let’s add one more thing.

    I want to copy the text of the link (i.e website.com or website2.com etc.) and insert it in that href="http://" to make a complete functioning link that links externally for all of the sites in the list.

    Can you solve it?

    # February 16, 2010 at 1:33 am

    See how this works:

    Code:
    $(“ul#site-list li”).wrapInner(““);
    $(“ul#site-list li a”).each(function(){
    $(this).attr({
    href: “http://” +$(this).html(),
    target: “_blank”
    });
    });
    # February 16, 2010 at 2:02 am

    Fantastic!
    Very well done :)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".