Skip to content

Commit 9cc2aea

Browse files
committed
Fix Failed to execute 'replaceWith' on 'Element'
1 parent aaddf55 commit 9cc2aea

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

resources/views/livewire/profile.blade.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class="cursor-pointer hover:underline"
5757
label="Username"
5858
type="text"
5959
wire:model="username"
60-
x-on:input="usernameInput"
60+
x-on:input="$js.usernameInput"
6161
/>
6262

6363
<x-input-text
@@ -164,9 +164,11 @@ class="xs:max-w-30 ml-auto w-full text-xs/3"
164164
</x-form>
165165
</div>
166166

167-
<script lang="js">
168-
const usernameInput = (event) => {
169-
event.target.value = event.target.value.replaceAll(/[^a-zA-Z0-9_]/g, "_").toLowerCase()
170-
}
171-
</script>
167+
@script
168+
<script lang="js">
169+
$js.usernameInput = (event) => {
170+
event.target.value = event.target.value.replaceAll(/[^a-zA-Z0-9_]/g, "_").toLowerCase()
171+
}
172+
</script>
173+
@endscript
172174
</x-contents>

resources/views/livewire/users/profile.blade.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class="size-24 rounded-full"
2929
label="Username"
3030
type="text"
3131
wire:model="username"
32-
x-on:input="usernameInput"
32+
x-on:input="$js.usernameInput"
3333
/>
3434

3535
<x-input-text
@@ -142,9 +142,11 @@ class="xs:max-w-30 ml-auto w-full text-xs/3"
142142
</x-button>
143143
</div>
144144

145-
<script lang="js">
146-
const usernameInput = (event) => {
147-
event.target.value = event.target.value.replaceAll(/[^a-zA-Z0-9_]/g, "_").toLowerCase()
148-
}
149-
</script>
145+
@script
146+
<script lang="js">
147+
$js.usernameInput = (event) => {
148+
event.target.value = event.target.value.replaceAll(/[^a-zA-Z0-9_]/g, "_").toLowerCase()
149+
}
150+
</script>
151+
@endscript
150152
</x-contents>

0 commit comments

Comments
 (0)