I have this button in the blade file of a livewire
component:
<button type="button" title="Adauga o disciplina noua" class="ml-2 my-auto bg-blue-500 text-white px-2 py-1 rounded-lg" onclick="adaugaSelect()">+</button>
and the function:
`
@script
<script>
function adaugaSelect() {
}
</script>
@endscript`
And in console I get Uncaught ReferenceError: adaugaSelect is not defined . From what i read there might be an issue with the @script directive
.
Is there any fixes?
googling and moving the function outside the blade file, but is not doable
2
Answers
I also have noticed this issue in livewire3 .. I solve it by not using @script at all.. at will work without that just fine… here is an example
thats showing error just like yours…
so i just remove the @script tag
back in livewire V2 you will find that they where using @push("scripts") but it was also not working for me…
apparently the @script … @endscript issue was solved on Livewire version 3.3
try to update the Livewire package
composer update livewire/livewire