Hi Michael,

You could do it a little differently. This should work:

$('.myrow').click(function(event) {
  if (event.target.type != 'checkbox') {
    $('input:checkbox', this).trigger('click');
  }
});

so, when the user clicks somewhere in the row, if the click isn't directly on a checkbox, it triggers a click for that row's checkbox.

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Sep 8, 2008, at 4:18 PM, Michael Smith wrote:


Thanks for the reply.

I added a return false;

http://dev.savingforchildren.co.uk/mjs/row_select_2.epl

But it doesn't seem to make any difference.

Am I missing something?

Thanks again

Michael


On Mon, Sep 8, 2008 at 7:18 PM, Danny <[EMAIL PROTECTED]> wrote:

add " return false; " to your click handler to keep the click from
getting to the checkbox itself.
Danny

On Sep 8, 10:55 am, "Michael Smith" <[EMAIL PROTECTED]> wrote:
Hi there,

I'm trying to make a page which automatically toggles a checkbox when
you click anywhere on the row.

Here's a version I've cut down to the bare bones to illustrate

http://dev.savingforchildren.co.uk/mjs/row_select.epl

It seems to work fine unless the user actually clicks on the checkbox itself. In this case it seems that it actually gets toggled twice and
so reverts to its original state.

Any suggestions on the cleanest / simples way to avoid this? (I can
think of a few messy ways)

Thanks

Michael


Reply via email to