Simple JavaScript is not running in the filament widget

<x-filament-widgets::widget> <x-filament::section> <div class="bg-white p-6 rounded-2xl shadow w-full max-w-md"> <h2 class="text-xl font-semibold mb-4">Profit Calculator</h2> <div class="mb-4"> <label class="block font-medium mb-1">Timeframe</label> <div class="flex gap-4"> <label><input type="radio" name="timeframe" value="month" checked> Per month</label> <label><input type="radio" name="timeframe" value="year"> Per year</label> </div> </div>

</x-filament::section> </x-filament-widgets::widget> <script> document.read(function(){ alert('test'); document.addEventListener('DOMContentLoaded', function () { const leadsInput = document.getElementById('leads'); const bookingsInput = document.getElementById('bookings'); const priceInput = document.getElementById('price'); const revenueDisplay = document.getElementById('revenue'); function calculateRevenue() { const leads = parseInt(leadsInput.value) 0; const bookings = parseInt(bookingsInput.value) 0; const price = parseFloat(priceInput.value) || 0; const revenue = bookings * price; revenueDisplay.innerText = '€' + revenue.toFixed(2); } leadsInput.addEventListener('input', calculateRevenue); bookingsInput.addEventListener('input', calculateRevenue); priceInput.addEventListener('input', calculateRevenue); }); }) </script>
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?