how to check in js if element is li or is button code example
Example: how to check in js if element is li or is button
// use attribute .tagName, which returns a type e.g. DIV, BUTTON, LI etc.
const functionName = () => {
if(e.target.tagName == 'BUTTON') {
console.log("It's a button";
} else {
console.log("It's not a button");
}
}
// if you prefer: function functionName (params) {action} instead of "e.target" use this