Thanks Richard for your reply.

I have tried your code but looks like something is wrong.
To be sure I catch the right id I tried something like

     $("#product_links a").bind("click", function() { alert( $
(this).parent().attr("id") ); });

and I get an empty alert window.


Am I missing something?

Thanks again for your help. I appreciate it



Sig


On Aug 1, 11:46 am, "Richard D. Worth" <rdwo...@gmail.com> wrote:
> $("#product_links a ").bind("click", function() {
>   pupup_elemet( $(this).parent().attr("id") );
>
> });
>
> - Richard
>
>
>
> On Sat, Aug 1, 2009 at 2:39 PM, macsig <sigbac...@gmail.com> wrote:
>
> > Hello guys,
> > I'm trying to update a script I found out there in order to fit better
> > my needs.
>
> > The first step I want to update is the capability to bind a dynamic
> > number of anchors.
> > Right now with the HTML below
>
> > <ul id="product_links">
> >   <li class="first" ><a>FIRST></a></li>
> >   <li class="second">SECOND</a></li>
> >   <li class="third"><a>THIRD</a></li>
> > </ul>
>
> > I have the script below:
>
> >  $("#product_links .first a ").bind("click", function(){ pupup_element
> > ("first"); });
> >  $("#product_links .second a ").bind("click", function(){ pupup_element
> > ("second");});
> >  $("#product_links .third a ").bind("click", function(){ pupup_element
> > ("third");});
>
> > It works fine but since the number of anchors changes dynamically
> > (through RoR) I'd like to have just 1 line that binds all the anchors.
> > So here 2 questions for you:
>
> > - how can I select an element's parent?
> > - Does the code below work?
>
> >  $("#product_links a ").bind("click", function(){ pupup_elemet
> > ("this.PARENT.id");});
>
> > basically I want to bind all the anchors within the product_links list
> > to popup_element function that takes as a parameter the ID of the
> > anchor parent. In my case the id of the list item.
>
> > Thanks and have a nice weekend.
>
> > Sig

Reply via email to