Skip to content

Instantly share code, notes, and snippets.

@abdasis
Created November 17, 2022 23:51
Show Gist options
  • Save abdasis/c82440b229957656741991ad86f8eda1 to your computer and use it in GitHub Desktop.
Save abdasis/c82440b229957656741991ad86f8eda1 to your computer and use it in GitHub Desktop.
Method membuat format rupiah Laravel Livewire
@push('scripts')
<script>
var total_pembayaran = document.getElementById('total_pembayaran');
total_pembayaran.addEventListener('keyup', (event) => {
var value = total_pembayaran.value.replace(/[^\d,]/g, '');
@this.set('total_pembayaran', total_pembayaran);
total_pembayaran.value = rupiah(value)
})
Livewire.onLoad(() => {
total_pembayaran.value = rupiah(@this.total_pembayaran);
})
</script>
@endpush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment