Hi Hugh,

You might want to use the .each() method for this so you can iterate through the links and create new elements as you go.

Something like this should work:

var $extLinks;
$("#content a").not("[EMAIL PROTECTED]'mysite.com/']").each(function(index) {
  if (index == 0) {
    $extLinks = $('<ol id="extLinks"></ol>');
  }
  var thisHref = this.href;
  $('<li></li>').text(thisHref).appendTo($extLinks);
});
$extLinks.appendTo("#content");


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Jul 16, 2007, at 3:39 PM, Hugh Hayes wrote:

Hi All-

This is a newbie designer question. I think jquery's great and I'm trying to find more uses for it.

I've got this-

$("#content a").not("[EMAIL PROTECTED]'mysite.com/']").clone().appendTo ("#content");

I was trying to get a line break in between each link but couldn't and I was hoping somebody here could give me a hand.

I'm trying to learn so I'm trying to do this step-by-step. I've been reading the doc's and see that $("a") going to pick up the anchors. I saw .getUrlParam and tried .getUrlParam("href") but was only able to get "strHref has no properties."

It's probably obvious but what I'm trying to do is go through the content div, collect all the external "http:..." addresses and put them into a <ul> or <ol> at the bottom of the page. I just want to make it easy for people to copy them.

Thanks and thanks for jquery. When you're doing sites by yourself it's hard to add the kind of enhancements that jquery offers.

Thanks again,

Hugh


Reply via email to