I will try to avoid duplicate questions and be as clear as possible. I recently created a js script to do a filtered search of a table and I need this file to be included on multiple blades. The problem is that the script works if it is pasted into the blade, but I cannot include it properly into the blade, I tried to put it in the public folder and install mix, unsuccessful in both cases. I'm sure that the problem is the folder where i put the js file and how i try to include it, but i didn't find a solution even though I tried in every way.
This is my js file(filtering_script.js):
//ricerca filtrata tra le tabelle
function Filtering() {
// Dichiara le variabili
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")[0];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
I know it's probably a stupid problem but i can't really solve it, hope someone helps me, thank you.