<form action="" id="form">
<div class="box valide">
<input type="text" class="list mega">
</div>
</form>
document.querySelector("#form").addEventListener("keydown", function (e) {
console.log(e.target.parentElement.classList);
console.log(e.target.parentElement.classList.contains["valide"])
if (e.target.parentElement.classList.contains["valide"]) {
console.log("YES");
} else {
console.log("NO");
}
});
- console.log(e.target.parentElement.classList.contains["valide"]);
+ console.log(e.target.parentElement.classList.contains("valide"));
- if (e.target.parentElement.classList.contains["valide"]);
+ if (e.target.parentElement.classList.contains("valide"));