jQuery: The Write Less, Do More JavaScript Library

on-page navigation

View: New views
2 Messages — Rating Filter:   Alert me  

on-page navigation

by neandr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to build a special on-page navigation. The following html
is used to have icons/buttons which in-/decrement to header lines on
the same page. The <hx> elements are identified by class and have
'id's.

<h3 class="sectionseparator" id="section1">
<a href="#" title="<<"><img align="left" alt=""
class="dSelection" /><br />
</a> <hr />
<a href="#" title=">>"><img align="right" alt=""
class="iSelection" /></a>
Section 1
</h3>

A very first code (I'm a total newbie with JQuery) is this

   $(document).ready(function(){
     $("a").click(function(){
       alert("xThis:" + $(this).parent);
     })
   });

but it only gives:

xThis:function (G) {
    var H = o.map(this, F);
    if (G && typeof G == "string") {
        H = o.multiFilter(G, H);
    }
    return this.pushStack(o.unique(H), E, G);
}

Without .parent it's:   xThis:[object Object]
How can I get info about theobject?

Any help/idea how I have write to grap the <h3> with it's 'id'??
Any help welcomed!

PS: wondering why my previous post (as of Nov 4th) isn't 'moderated'
yet!!?? And receiving 'non-delivery' message on my gmail account.

Re: on-page navigation

by Richard D. Worth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

change

.parent

to

.parent()

so you're calling the function and getting the return value of the function, rather than simply returning the function itself (whose contents were showing up in your alert).

- Richard

On Thu, Nov 5, 2009 at 6:55 PM, neandr <gneandr@...> wrote:
I'm trying to build a special on-page navigation. The following html
is used to have icons/buttons which in-/decrement to header lines on
the same page. The <hx> elements are identified by class and have
'id's.

<h3 class="sectionseparator" id="section1">
<a href="#" title="&lt;&lt;"><img align="left" alt=""
class="dSelection" /><br />
</a> <hr />
<a href="#" title="&gt;&gt;"><img align="right" alt=""
class="iSelection" /></a>
Section 1
</h3>

A very first code (I'm a total newbie with JQuery) is this

  $(document).ready(function(){
    $("a").click(function(){
      alert("xThis:" + $(this).parent);
    })
  });

but it only gives:

xThis:function (G) {
   var H = o.map(this, F);
   if (G && typeof G == "string") {
       H = o.multiFilter(G, H);
   }
   return this.pushStack(o.unique(H), E, G);
}

Without .parent it's:   xThis:[object Object]
How can I get info about theobject?

Any help/idea how I have write to grap the <h3> with it's 'id'??
Any help welcomed!

PS: wondering why my previous post (as of Nov 4th) isn't 'moderated'
yet!!?? And receiving 'non-delivery' message on my gmail account.