King Karl-

Success!

It ended up being:

<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function() {
var $extLinks;
$("#content a").not("[EMAIL PROTECTED]'mysite.com/']").not("[EMAIL 
PROTECTED]'mailto']").each(function(index) {
  if (index == 0) {
    $extLinks = $('<ol id="extLinks"></ol>');
  }
  var thisHref = this.href;
  $('<li></li>').text(thisHref).appendTo($extLinks);
$extLinks.appendTo("#content");
});
/* ]]> */
});
</script>

It was the order of the last three or four lines that needed to be changed. I 
got rid of the mailto's, too.

I know it's hard to support us cut-and-paste guys, there isn't a heck of a lot 
that we can do for the group / jquery.  Since it does say designers on the 
homepage, I can offer an opinion that might help.

The plug-ins are great, but I'm really a lot more likely to be looking at the 
Cookbook on the FAQ page.  Doing things like the script you wrote for me, 
alternate table row colors, make a footer that sticks to the bottom of the 
viewport no matter how much content is on the page, without making syntax 
errors or extensive debugging, that's what I'd find really useful.  My buddies 
and I have looked at the plug-ins a lot, thought they were really cool but 
we're not using them.  We're already both using the script we've been working 
on here.

Hope that helps.  Thanks again for your help with this script and thanks to all 
the people that take care of jquery.

Take care.

Hugh



  ----- Original Message ----- 
  From: Karl Swedberg 
  To: jquery-en@googlegroups.com 
  Sent: Tuesday, July 17, 2007 12:35 PM
  Subject: [jQuery] Re: search text, find urls and list


  Hi Hugh,


  Ah, yes, looks like you're missing the line with }); that should come right 
before $extLinks.appendTo('#content'); 
  It's needed there to close the .each()


  Try copy/pasting this:

  <script src="http://www.helderberg-bmdc.org/scripts/jquery.js"; 
type="text/javascript"></script>
  <script type="text/javascript">
  /* <![CDATA[ */
  $(document).ready(function() {
  var $extLinks;
  $("#content a").not("[EMAIL 
PROTECTED]'helderberg-bmdc.org/']").each(function(index) {
    if (index == 0) {
      $extLinks = $('<ol id="extLinks"></ol>');
    } 
    var thisHref = this.href;
    $('<li></li>').text(thisHref).appendTo($extLinks);
  });
  $extLinks.appendTo("#content");
  )};
  /* ]]> */
  </script>




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






  On Jul 17, 2007, at 10:37 AM, Hugh Hayes wrote:


    Hi Karl-

    Thanks.  I really appreciate it.  I've got (I think) syntax errors.  The 
firefox console is telling me "missing } after function body \n" - it seems to 
be the last line of the code and no matter what combination of characters I use 
there.  Here's what I've got:

    <script src="http://www.helderberg-bmdc.org/scripts/jquery.js"; 
type="text/javascript"></script>
    <script type="text/javascript">
    /* <![CDATA[ */
    $(document).ready(function() {
    var $extLinks;
    $("#content a").not("[EMAIL 
PROTECTED]'helderberg-bmdc.org/']").each(function(index) {
      if (index == 0) {
        $extLinks = $('<ol id="extLinks"></ol>');
      } 
      var thisHref = this.href;
      $('<li></li>').text(thisHref).appendTo($extLinks);
    $extLinks.appendTo("#content");
    )};
    /* ]]> */
    </script>

    I'm serving the files up as xhtml 1.1 with mime-type application/xhtml+xml 
for the browsers that understand it and text/html (html 4.01) for the browsers 
that don't.  The page validates and there's no css errors.

    Thanks in advance for anyone's hints, tips or fixes.

    Take care.

    Hugh



    ----- Original Message -----
      From: Karl Swedberg
      To: jquery-en@googlegroups.com
      Sent: Monday, July 16, 2007 4:05 PM
      Subject: [jQuery] Re: search text, find urls and list


      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