Question : javascript check if element has class
Answered by : code-grepper
if(document.getElementById("myElmentID").classList.contains("hidden")){
// I have the 'hidden' class
}
Source : | Last Update : Fri, 09 Aug 19
Question : javascript check if element has class
Answered by : xanthous-xenomorph-wyygzq6lf3lv
const element = document.querySelector("#box");
element.classList.contains("active");
Source : https://codetogo.io/how-to-check-if-element-has-class-in-javascript/ | Last Update : Sat, 15 Aug 20
Question : check if body has class javascript
Answered by : kateryna-kovtun
document.body.classList.contains('my-class-name')
Source : | Last Update : Fri, 23 Apr 21
Question : js check if class has function
Answered by : ivan-londono
if (typeof me.onChange !== "undefined") { // safe to use the function me.onChange()
}
//or better yet
if (typeof me.onChange === "function") { // safe to use the function me.onChange()
}
Source : | Last Update : Wed, 25 Jan 23