The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Programming Fundamentals" Dec 02 - 2:00 PM Eastern

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:


    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 or 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:

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

    Very well done :)

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

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed