Sorry, totally misread Josh's post and transposed Brian for Eric. That's what happens when I don't have coffee in the morning :P
On Mar 11, 11:33 pm, Eric Gun <gunawan.e...@gmail.com> wrote: > Well, i guess we have to wait for brian himself to explain what he > means. > > @Josh: by the way, if i'm not mistaken or miscount (and i haven't > tried to run it yet), i think your script has one quote (') less, > hasn't it? > > Anyway, those 'string munging' is indeed rather confusing... > > On Mar 12, 12:03 am, mkmanning <michaell...@gmail.com> wrote: > > > I believe Brian opted for the suggestion that doesn't involve string > > munging; it's just using the natural index of the elements, no slicing > > or dicing :) > > > On Mar 11, 1:01 am, Josh Powell <seas...@gmail.com> wrote: > > > > *shrugs* up to you, brian means to use string.splice(a); where a = > > > number of characters before the index that is tacked on. so if the > > > name/id is foo_1, foo_2 then you'll do: > > > > $('[id^=foo_]').change(function() { > > > $('[name=post-amount_' + $(this).attr('id').slice(3) + ]').val($ > > > (this).val()); > > > > }); > > > > I personally find this kind of string munging difficult to read and > > > maintain. Could just be personal preference though. Good luck. > > > > Josh Powell > > > > On Mar 10, 10:39 pm, Eric Gun <gunawan.e...@gmail.com> wrote: > > > > > @mkmanning: Well done!! Your script works well. Thanks, and great > > > > job! :) > > > > > @brian-263: Thanks for the idea. Yup, i'm using PHP as i said before. > > > > Therefore, i need those '[]'. > > > > Anyway, i'm still curious with what you mean by 'parse out the index > > > > from each of the IDs ...'. I'm not really sure how to do it. If you > > > > don't mind, can you give me an example script? > > > > > @Josh Powell: Thanks for being the first one to reply my post :) > > > > I'm sorry, but i'm afraid i agree with brian-263 about better not > > > > making up new attribute instead of optimizing pre-defined ones. > > > > > @all: Maybe i was wrong to explain my problem when i used the word > > > > 'instantly' (as this is my first post :) In fact, the 'deal-post' > > > > table is located in different tab panel with the 'deal-summary' one > > > > (i'm using JQuery UI plugin for tabs). So, i will drop the 'keyup' > > > > event and also forget about autocomplete plugins for now. I will use > > > > the 'change' event instead, as i think it's enough for me. > > > > > Thanks guys!!! > > > > > On Mar 10, 4:07 pm, Eric Gun <gunawan.e...@gmail.com> wrote: > > > > > > Sorry guys, just had a couple days off. > > > > > I will look forward to your answers and reply back here soon. > > > > > > Thanks for concerning, > > > > > > Regards, > > > > > > On Mar 8, 8:22 am, mkmanning <michaell...@gmail.com> wrote: > > > > > > > With the markup example in the OP, use this: > > > > > > > var dp = $('#deal-post tbody tr'); > > > > > > dp.find('input[name^=dealAmount]').keyup(function(){ > > > > > > var amount = $(this); > > > > > > $('#deal-summary tbody > > > > > > tr:eq('+dp.index(amount.closest('tr')) > > > > > > +')').find('td.inc-current').text(amount.val()); > > > > > > > }); > > > > > > > On Mar 7, 4:10 pm, brian <bally.z...@gmail.com> wrote: > > > > > > > > On Sat, Mar 7, 2009 at 6:21 PM, Josh Powell <seas...@gmail.com> > > > > > > > wrote: > > > > > > > > > 6 of one... half dozen of another... > > > > > > > > I don't buy that. I've suggested using an attribute whose purpose > > > > > > > is > > > > > > > well defined. Making up attributes that aren't represented by the > > > > > > > DOCTYPE is a bad idea. Don't get me wrong--I've done it before. > > > > > > > Though > > > > > > > always to store temporary info. Happily, we have data for that, > > > > > > > now. > > > > > > > The OP's needs, though, are to identify table cells as being > > > > > > > connected > > > > > > > to specific text inputs. That's what ID is for.