By event.target, how I know that it is checkbox or it is radio?
.nodeName
gives the html
tag used so you have to use .type
to get the type of the node there.
Try this one:
console.log(event.target.type);
For those of you looking for the pure JavaScript way, it's event.target.tagName
.
That property is an uppercase string of the element type, like "A", "UL", "LI", etc.
console.log($(event.target).is(':radio'));console.log($(event.target).is('[type="radio"]'));