0

I have a jquery function that binds all tr's with the class item to a click function that will redirect to another page. inside this tr though is a checkbox. How can i allow this checkbox to function correctly instead of acting on the tr's click function?

user398314
  • 367
  • 4
  • 12

3 Answers3

1

You might want to post code, but briefly, I would add a separate click function just for the password, and in it, call event.stopPropagation().

Jacob Mattison
  • 50,258
  • 9
  • 107
  • 126
1

Here is what you are looking for:

jquery stop child triggering parent event

Community
  • 1
  • 1
Dustin Laine
  • 37,935
  • 10
  • 86
  • 125
0

You can also bind it to a click function which stops the even from being passed on via return false.

$('#checkbox').click(function() { return false; })

Another way would be to position your checkbox above the tr. This would however not size the tr with the checkbox in it (as you made it independent). This could be done with position:absolute, or you could also try z-index (although I’m not sure this will work with events).

Kissaki
  • 8,810
  • 5
  • 40
  • 42