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() { > $('.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' : > ''}); > }); > }); > > }); > > :-) > > --Karl > _________________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Nov 25, 2007, at 5:15 PM, jonhobbs wrote: > > > > > Hi, > > > I hope somebody can help me. I'm trying to write a function which will > > tick every checkbox in a column when you tick the checkbox in the > > header. > > > The plan is to attach an evetn to every checkbox in the header which > > when you check it will find the column bumber of the cell it is in and > > plug that number into the following code where the x is... > > > $(".Grid tbody tr td:nth-child(x) > > [EMAIL PROTECTED]'checkbox']").each(function() { > > this.checked = true; > > }); > > > I can figure out how to get the parent element of the checkbox (which > > will be a TD), just don't know how to find out that cells position in > > the table row. > > > Any help would be appreciated.