views:

264

answers:

3
 $('input[type=checkbox]').unbind().click(function(e){
  $(this).attr('checked', true)
  return false;
 });

I NEED to return false because I have an event on its parent and I don't want to trigger that. It just WON'T check that checkbox :| Already it drive me insane.

I think I used this before on another project and I had no problems at all, but now... crazy :(

Thank you guys!

+1  A: 

You're missing a ] at the end of your jQuery selector

Gareth
this should have been a comment, and now should be deleted
John Sheehan
why? tha twould prevent it from working.
Shawn Simon
A: 

You're missing a ] at the end of your jQuery selector

Actually i don't. I miss typed first time. In my code is correct this part. Sorry for this

Ionut Staicu
+2  A: 
$('input[type=checkbox]').unbind().click(function(e){
    e.stopPropagation();
});

Edit: I'm not sure what you need .unbind() for, but you should beware that that is canceling any other events you've put on those checkboxes.

eyelidlessness
thanks, that works like a CHARM!
Ionut Staicu