@OP: From your example, it appears that the number you want is the
categoryid param in the anchor's href. If that's always the case, you
could save all the DOM traversing and just extract it from the anchor:

$('a:contains("Edit")').click(function(){
  var n = /categoryid=(\d+)&/.exec(this.href);
  n = (n && n.length>1)?n[1]:n; //null or index 1
  your_function(n);
});

You could make your selector easier if you could add a class to the
anchor, such as $('a.edit'); for that matter you could simplify the
extraction of the ID if you just make it an id on the anchor as well:
<a id="c5029" ...> (id's can't start with numbers):

this.id.replace('c','');

HTH

On Aug 14, 8:35 am, Laker Netman <laker.net...@gmail.com> wrote:
> Hi all. Here is a section of a page I generate:
> <tr>
>         <td><a name="5029">5029</a></td>
>         <td>1100</td>
>         <td>2</td>
>         <td><a href="index.cfm?
> action=showsubtree&amp;categoryid=5029">Products</a></td>
>         <td><a href="index.cfm?action=deletenode&amp;categoryid=5029">Delete</
> a></td>
>         <td><a href="index.cfm?action=newnode&amp;categoryid=5029">New</a></
> td>
>         <td><a href="index.cfm?
> action=editnode&amp;categoryid=5029&amp;categoryName=Products&amp;categoryU 
> RL=&amp;categoryType=1&amp;parentCategoryId=1100">Edit</
> a>   </td>
>         <td><a href="index.cfm?action=moveup&amp;categoryid=5029">Move Up</
> a></td>
>         <td><a href="index.cfm?action=movedown&amp;categoryid=5029">Move
> Down</a></td>
>         <td><select class="mover" id="5029">
>                         <option class="selectTitle">Move to...</option>
>                 </select>
>         </td>
> </tr>
>
> When I click on the "Edit" link in the 7th TD (or 6th for you zero-
> based folks :) I want to call a function and have 5029 available to
> use as a parameter to it. I really don't care which element or
> attribute I use to get the value (as it obviously appears in several
> places), whichever is easiest. I'm thinking the 1st TD, either the "a"
> name attribute or text.
>
> I just can't seem to put together a chain of selectors together that
> gets me what I want.
>
> Can someone help?
>
> TIA,
> Laker

Reply via email to