F
Filament5mo ago
jjo63

Using jquery within a blade in Filament

I want to be able to do some stuff that requires jquery. I have done the following: - downloaded jquery and placed it in
__DIR__ . '/../../resources/js/jquery-3.7.1.min.js
__DIR__ . '/../../resources/js/jquery-3.7.1.min.js
- registered it in
AppServiceProvider
AppServiceProvider
thus: public function boot(): void { FilamentAsset::register([ Js::make('jquery', __DIR__ . '/../../resources/js/jquery-3.7.1.min.js'), ]); } - ran
php artisan filament:assets
php artisan filament:assets
and can see that jquery.js is now present in public/app/js I have this very simple blade content (
doclink.blade.php
doclink.blade.php
) : <div> <!-- Test Button to trigger jQuery --> <button type="button" class="btn btn-primary" id="testButton"> jquery Button </button> </div> <!-- jQuery Test Script --> <script> $(document).ready(function() { $('#testButton').click(function() { alert('jQuery is working!'); }); }); </script> Q: is this valid within a blade? The blade is referenced by a custom column which is defined within my resource as
return $table
->defaultGroup('folder')
->columns([

doclink::make(name: 'file_id'),
return $table
->defaultGroup('folder')
->columns([

doclink::make(name: 'file_id'),
For clarity, I am seeing the button "jquery btn" displayed - just nothing happens when I click it. Oh and I have verified that jquery is being loaded (see image). So... what obvious thing am I missing here..? thx! j
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server