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