[jQuery] Re: toggle checkbox when clicking td

2009-02-04 Thread Karl Swedberg
On Feb 2, 2009, at 10:37 PM, Karl Swedberg wrote: On Feb 2, 2009, at 6:47 PM, Slafs wrote: Karl thanks for your tutorial. But it seems that examples for adding the selected class doesn't work when I click the row but only the checkbox itself Well, that is very strange. It works with

[jQuery] Re: toggle checkbox when clicking td

2009-02-03 Thread Dave Methvin
Well, that is very strange. It works with jQuery 1.2.6, but not with   1.3.1. Hmm. Will have to investigate. Most likely the problem is that .trigger()ed clicks bubble in 1.3 but they didn't in 1.2, and it's bubbling back up to the tr.

[jQuery] Re: toggle checkbox when clicking td

2009-02-03 Thread Karl Swedberg
Hello again, Thanks a lot for pointing out the problem in the tutorial. I have fixed it to work for 1.3.1: http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click#update1 --Karl Karl Swedberg www.englishrules.com www.learningjquery.com

[jQuery] Re: toggle checkbox when clicking td

2009-02-03 Thread Karl Swedberg
On Feb 3, 2009, at 9:19 AM, Dave Methvin wrote: Well, that is very strange. It works with jQuery 1.2.6, but not with 1.3.1. Hmm. Will have to investigate. Most likely the problem is that .trigger()ed clicks bubble in 1.3 but they didn't in 1.2, and it's bubbling back up to the tr. Yeah,

[jQuery] Re: toggle checkbox when clicking td

2009-02-03 Thread Dave Methvin
Thanks a lot for pointing out the problem in the tutorial. I have   fixed it to work for 1.3.1: Hey Karl, it looks like something got messed up on that page. Maybe the css is missing?

[jQuery] Re: toggle checkbox when clicking td

2009-02-03 Thread Karl Swedberg
On Feb 3, 2009, at 9:32 PM, Dave Methvin wrote: Thanks a lot for pointing out the problem in the tutorial. I have fixed it to work for 1.3.1: Hey Karl, it looks like something got messed up on that page. Maybe the css is missing? Wow, that was a colossal failure! Yeah, my minifier didn't

[jQuery] Re: toggle checkbox when clicking td

2009-02-02 Thread benjam
Another method that I use to do the very same thing (1.2.6) $('tbody tr').click( function(event) { if ($(event.target).is('input')) { return; } var $input = $(this).find('input'); if ($input.length)

[jQuery] Re: toggle checkbox when clicking td

2009-02-02 Thread Slafs
Hi! Thank you all for your replies! With a big help from my friend now i've got this: $(.myTable tr).each(function() { var tr = $(this); var input = $(input[type=checkbox], tr); tr.click(function() { input.attr('checked',

[jQuery] Re: toggle checkbox when clicking td

2009-02-02 Thread Karl Swedberg
On Feb 2, 2009, at 6:47 PM, Slafs wrote: Karl thanks for your tutorial. But it seems that examples for adding the selected class doesn't work when I click the row but only the checkbox itself Well, that is very strange. It works with jQuery 1.2.6, but not with 1.3.1. Hmm. Will have to

[jQuery] Re: toggle checkbox when clicking td

2009-02-01 Thread Slafs
I'm one step closer ;]. I'm traversing from tr not from td. And it seems to work fine except that now the checkbox itself doesn't have the ability to check or uncheck so i've tried to add some more code ([1]) but then I have to doublecklick it to check or unckeck =/ weird... my code: ---

[jQuery] Re: toggle checkbox when clicking td

2009-02-01 Thread Dave Methvin
now the checkbox itself doesn't have the ability to check or uncheck What's happening is that when you click the checkbox directly, it changes the state of the checkbox. But, the click event then bubbles to the tr, where the handler changes it (back)! There are several different ways to handle

[jQuery] Re: toggle checkbox when clicking td

2009-02-01 Thread Manowar721
And yet, another way using jQuery-1.2.6. Like Dave Methvin said, there is prolly many ways to do it... var checkIt = function(){ if ($(this).siblings().children().filter(:checkbox).attr (checked)==false) { $(this).siblings().children().filter(:checkbox).attr (checked,checked);

[jQuery] Re: toggle checkbox when clicking td

2009-02-01 Thread Karl Swedberg
Yeah, what Dave said. Also, I wrote a tutorial a couple months ago about this very topic: http://www.learningjquery.com/2008/12/quick-tip-click-table-row-to-trigger-a-checkbox-click --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 1, 2009, at 4:20 PM,