I have the same question.
Mar 21, 2021
4
Level 37
IMask with Livewire and Alpine
Hi folks,
I am trying to apply IMask js with livewire, which works fine with the following code:
<section class="px-4"
x-data
x-init=" IMask( $refs.mobile, { mask: '+{1} (000) 000-0000' }); "
>
<div class="form-group">
<label class="control-label">Mobile # <x-required /></label>
<input
x-ref="mobile"
wire:model.lazy="mobile"
type="text"
class="form-control @error('mobile'){{ 'border border-danger' }} @else {{ 'border border-success' }}@enderror"
placeholder="(000) 000-0000"
>
@error('mobile')<div class="invalid-feedback" style="display: block;" role="alert">{{ $message }}</div>@enderror
</div>
</section>
This works fine, but the thing is I want to unmask it before I submit it to be able to process the unmasked value of the field (unless there is a bitter way).
And is there a solution for any package or just this one.
Thank you,
Please or to participate in this conversation.