I think the best place to put it is in the tr, so it's something
like:
tr id=row_1234
and you can retrieve it when you click on Edit (untested):
var id = $(this).closest(tr).attr(id).split('_')[1]; // 1234
But for your current scenario, you can probably do something like
(untested):
var id =
Thanks James. Yeah, I'd like to trim some of the bulk from this app,
but I'm one of several cooks, so I have to compromise a bit ;-)
Appreciate the response.
Laker
On Aug 14, 1:26 pm, James james.gp@gmail.com wrote:
I think the best place to put it is in the tr, so it's something
like:
That HTML should be traversable without any modifications.
What I would do is traverse up to the containing tr by using $.closest()
var tr = $(this).closest('tr');
Then, find the a with the name attribute:
var a = tr.find('a[name]');
from there, you can pull the 5029 out of the name attribute
@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);
4 matches
Mail list logo