[jQuery] Re: UPDATE: code review, suggestions for condensing / reuse?

2007-04-05 Thread Ronald Haring
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.

[jQuery] Re: UPDATE: code review, suggestions for condensing / reuse?

2007-04-05 Thread David Duymelinck
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

[jQuery] Re: UPDATE: code review, suggestions for condensing / reuse?

2007-04-05 Thread David Duymelinck
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 =

[jQuery] Re: UPDATE: code review, suggestions for condensing / reuse?

2007-04-03 Thread Brandon Aaron
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 +

[jQuery] Re: UPDATE: code review, suggestions for condensing / reuse?

2007-04-03 Thread Andy Matthews
: 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

[jQuery] Re: UPDATE: code review, suggestions for condensing / reuse?

2007-04-03 Thread Alex Ezell
:[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