I have this function here like this:
const Hydraulic = () => {
function myFunction() {
useEffect(() => {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}, []);
}
return (
Which is later on being called in the body from an input like this:
<input
type="text"
id="myInput"
onChange={myFunction()}
placeholder="Search for Part Number.."
title="Type in a name"
/>
^^^ I am not getting any error in the console or anywhere… it just doesn’t run, as if the function is never activated.
In a plain html website the input looks like this below… I changed it to onChange just for Nextjs… but it doesn’t activate anything…
<input
type="text"
id="myInput"
onkeyup="myFunction()"
placeholder="Search for Part Number.."
title="Type in a name"
/>