Thank you - this seemed the neatest solution and worked nicely for me.
Michael
On Tue, Sep 9, 2008 at 12:53 AM, Karl Swedberg [EMAIL PROTECTED] wrote:
Hi Michael,
You could do it a little differently. This should work:
$('.myrow').click(function(event) {
if (event.target.type !=
Except ... (sorry to come back on this one)
I'm trying to do something else ('growl' actually but that's not
important for the purposes of the issue) when the user checks/unchecks
the box
http://dev2.savingforchildren.co.uk/mjs/row_select_2.epl
As this demo now shows, when you check the box
Hi Michael,
Have you checked out the stopPropagation() method for events?
eg:
$(check_id).click(function(e){
e.stopPropagation();
});
This may help - I have used this on a clickable image on a table row
to stop the click expanding / contracting the table row.
Cheers
P
On Sep 9, 2:59 pm,
Hi Micheal,
You've probably already sorted this, but:
code
script
$('.checkbox').click(function(e) {
e.stopPropagation();
var action=$(this).attr('checked') ? 'checkbox: you checked it' :
'checkbox: you unchecked it'
alert(action)
});
$('.myrow').click(function(e) {
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
Try the following code:
$('.myrow').children().click(function() {
if ($(this).children('[EMAIL PROTECTED]').length == 0) {
var check_id = '#' + $(this).parent().attr('id') +
'checkbox';
$(check_id).attr('checked', !$(check_id).attr('checked'));
}
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
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,
8 matches
Mail list logo