[jQuery] Re: Getting the index of a cell in a row.

2007-11-27 Thread Karl Swedberg
:-) Thanks for buying the book! By the way, as John Resig can now attest, a portion of the proceeds goes right back to the jQuery project. So, thanks for helping jQuery, too. ;-) One more thing (to avoid going totally OT): I took the code that I wrote for you and dropped it into a page wi

[jQuery] Re: Getting the index of a cell in a row.

2007-11-27 Thread jonhobbs
Hi Karl, I've just realised where I've seen your name before. On the spine of the spine of the book sitting here on my desk :) An excellent book it is too. Jon On Nov 26, 7:09 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > Hi Jon, > > Here you go: > > $(document).ready(function() { >$('.Gr

[jQuery] Re: Getting the index of a cell in a row.

2007-11-26 Thread jonhobbs
Thanks guys, I have tried all the suggestions on here and have tried to adapt them for my grid. I think I'm very close but for some reason alghout each individual selector/traversal function seems to work in isolation, none of it seems to work when I put it all together. Can anybody spot any prob

[jQuery] Re: Getting the index of a cell in a row.

2007-11-26 Thread Karl Swedberg
Hi Jon, Here you go: $(document).ready(function() { $('.Grid th').each(function(column) { column ++; $('input:checkbox', this).click(function() { $('.Grid tbody tr td:nth-child(' + column + ') input:checkbox').attr({checked: $(this).is(':checked') ? 'checked' : ''}); })

[jQuery] Re: Getting the index of a cell in a row.

2007-11-26 Thread Glen Lipka
This is similar to another post. Couple of demos: http://www.commadot.com/jquery/rowindex.php http://www.commadot.com/jquery/colIndex.php Glen On Nov 26, 2007 10:20 AM, Wizzud <[EMAIL PROTECTED]> wrote: > > Assuming you a single checkbox in each th cell... > > var thboxes = $('.Grid thead th inp

[jQuery] Re: Getting the index of a cell in a row.

2007-11-26 Thread Wizzud
Assuming you a single checkbox in each th cell... var thboxes = $('.Grid thead th input:checkbox'); thboxes.click(function(){ var colNum = thboxes.index(this) + 1; // then your stuff... $(".Grid tbody tr td:nth-child(" + colNum + ")input:checkbox").each(function() { this.c