Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to extract java script elemet 
Javascript :: node code to read json file 
Javascript :: check string ifhas character in jquery 
Javascript :: cdate ssrs expressions 
Javascript :: native base change track color 
Javascript :: react route send informaion in url 
Javascript :: how to send json data to server in android using volley 
Javascript :: yarn dev error eacces windows 
Javascript :: save in local storage with expiration 
Javascript :: how to speak numbers in javascript 
Javascript :: liquid indicators in react native 
Javascript :: replace all commas in string javascript 
Javascript :: vscode multi level folder file creation 
Javascript :: get nested value on object react using dot 
Javascript :: 8.1.4. Array Length or .length 
Javascript :: 9.4.1.2. Loop Condition¶ 
Javascript :: strip add usage api docuemntation 
Javascript :: javascript reassignment 
Javascript :: get single element typeorm 
Javascript :: how to get selected option attribute value in jquery 
Javascript :: format large texts 
Javascript :: package json replace to dev dependencies 
Javascript :: .chartjs-render-monitor 
Javascript :: angular dynamic script loading 
Javascript :: auto closing not working jsx 
Javascript :: how do i count the number of occurrences in a string javascript 
Javascript :: how to pass information to a type=hidden from a function in javascript 
Javascript :: how to use magic css in react js 
Javascript :: extracting script elements 
Javascript :: paypal react native 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =