Select all images in page and add <a> tag?

Discussion in 'JavaScript' started by Miquexia, Apr 2, 2010.

  1. #1
    Hello,

    I'd like to select all the images (<img>) in my page and give them a <a> tag with a "src".

    Is this possible? Can I also do this with jQuery?

    Thanks
     
    Miquexia, Apr 2, 2010 IP
  2. canadianguy_001

    canadianguy_001 Peon

    Messages:
    97
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    jquery:

    $('img').wrap('<a href="link.html" />');
     
    canadianguy_001, Apr 2, 2010 IP