Looks good, only one suggestion, this line:
var id =
curImg.parent().parent().parent().parent().parent().parent().attr('id'); // get
the id of the parent TR tag
looks very brittle. If you change the table or tr a bit, then you are
lost. Why dont you try and add another class to the img e.g.
How does that makes it possible to change the table?
The solution for all those parents is
var id = curImg.parents('tr').attr('id');
With parents you will get all the parent elements and you can limit it
using an expression.
http://docs.jquery.com/DOM/Traversing#parents.28_expr_.29
On 5
Ok i was a bit too quick. You could use an idnumber for each image but
it will add more code to the html page.
On 5 apr, 14:23, David Duymelinck [EMAIL PROTECTED] wrote:
How does that makes it possible to change the table?
The solution for all those parents is
var id =
First off, this is functioning much better than before. Good work.
In the click handler you bind to the h1 you have a few areas where you
could optimize your code.
First you declare a var named outerchild like this:
var outerid = $(this).parent().attr(id);
var outerchild = $('#' + outerid +
: UPDATE: code review, suggestions for condensing /
reuse?
First off, this is functioning much better than before. Good work.
In the click handler you bind to the h1 you have a few areas where you could
optimize your code.
First you declare a var named outerchild like this:
var outerid
:[EMAIL PROTECTED] On
Behalf Of Brandon Aaron
Sent: Tuesday, April 03, 2007 8:50 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: UPDATE: code review, suggestions for condensing /
reuse?
First off, this is functioning much better than before. Good work.
In the click handler you bind to the h1
6 matches
Mail list logo