Trigger Action automatically when page loads

Hi, I want to trigger an action upon a page loads, but I can't find a method that triggers a button click, is there any way?
4 Replies
awcodes
awcodes14mo ago
You'd have to do that with some custom javascript.
Javier Mercedes
Javier MercedesOP14mo ago
Thanks, is there any example that I can follow?
awcodes
awcodes14mo ago
no that i know of. but you could use a renderhook to inline it or load a .js file with the code too.
waleedGRT
waleedGRT11mo ago
Perhaps this code could be helpful for someone.
->extraAttributes(function () {
$config += [
'wire:init' => new HtmlString('mountAction(\'modelname\')'),
]
return $config;
})
->extraAttributes(function () {
$config += [
'wire:init' => new HtmlString('mountAction(\'modelname\')'),
]
return $config;
})
Want results from more Discord servers?
Add your server