I have been trying to execute javascript code from my blade.php file, and it doesnt recognize the function that I want
I have this select
<div class="row mb-3">
<div class="col">
<form id="filter">
<div class="form-group">
<label for="statusFilter">Filtro por Estado</label>
<select onChange="filter()" class="form-control" id="statusFilter">
<option value="Todos">Todos</option>
<option value="Pendiente">Pendiente</option>
<option value="Aceptada">Aceptada</option>
<option value="Rechazada">Rechazada</option>
</select>
</div>
</form>
</div>
</div>
As you can see, when it changes it should trigger the filter function wich is
function filter(){
console.log("HOLAAAAA");
}
But instead of the console log, I get
absences:49 Uncaught TypeError: filter is not a function
at HTMLSelectElement.onchange (absences:49:84)
On the php file i’m importing the js file called absences.js like this
<script src="{{ asset('js/absences.js') }}"></script>
I tried calling it like this on the layout that I made
<script src="/js/absences.js"></script>
but it won’t work either.
It’s worth noticing that when I go to the route of the app (I’m working with Laragon) wich is http://justifacil.test/js/absences.js it returns all the code of the js file, so I assume that is correct and the app can retrieve the code but it wont execute on the on change event.