Karl Swedberg wrote:
Hi Howard,
Looks cool! Here is what I came up with (untested), starting with any
'tr' that contains a checkbox and going from there. I'm not sure what
you're asking about the ID, so I didn't put that part in here. Are you
going to use the id for something else later on?
Anyway, hope this helps you refine your code.
$('tr[input:checkbox]').click(function() {
var $toggleTicket = $(this).find('[EMAIL PROTECTED]');
if ($toggleTicket.is(':checked')) {
$toggleTicket.removeAttr('checked');
} else {
$toggleTicket.attr('checked', 'checked');
}
});
Ah, I didn't explain that so well. There are dozens of checkboxes, with
names like UpdateTicket32434, one per row. So I was looking to find all
of those, then assign the click event to the grandparent <tr>, but so
that the click event handler knows the name of the checkbox (the tr has
no id or name, so it can't be derived back again). Except I didn't think
about just searching for it again, as you do here, within the <tr>
rather than the whole document.
It was the each() and the part with the '@name='+myid+']' that felt
wrong to me in my version, and that solves both of those.
Thanks!