By event.target, how I know that it is checkbox or it is radio?
Solution 1:
.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);
Demo
Solution 2:
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.