I am trying to check the event.target.nodeName as follows:
$("input").click(function(e){
    if(e.target.nodeName == "LABEL") {
       alert('label click');
        e.preventDefault();
    } else {
       alert($(this).attr('checked') ? 'checked': 'unchecked');
    }
});
But the name never equals label? What am I doing wrong?
Quick jsfiddle
You should select the label(parent) element. Currently the only target of your click handler is the input element:
$("label").click(function(e){
  // ...
})
http://jsfiddle.net/j7nSq/
I think the reason this doesn't work is because this will only run if you click on input:
  if(e.target.nodeName == "LABEL") {
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With