Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 1, 2022 06:54 pm GMT

How to solve "Uncaught TypeError: Cannot read properties of undefined" in Javascript

`// Search Chat
const searchMessage = () => {
const val = messageSearch.value.toLowerCase();
message.forEach(chat => {
let name = chat.querySelectorAll("h5").textContent.toLowerCase();
if (name.indexOf(val) != -1) {
chat.style.display = "flex";
} else {
chat.style.display = "none";
}
});
}

//Search Message
messageSearch.addEventListener("keyup", searchMessage);`


Original Link: https://dev.to/arif0ne/how-to-solve-uncaught-typeerror-cannot-read-properties-of-undefined-in-javascript-1789

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To