tambahan satuan luas di denah

This commit is contained in:
majid
2025-02-13 13:40:30 +07:00
parent 90249b83e1
commit 5a4c8ab3a4
2 changed files with 42 additions and 7 deletions

View File

@@ -26,18 +26,27 @@
}
function formatNumber(input) {
let value = input.value.replace(/[^\d.]/g, '');
input.value = value;
}
// Ambil posisi kursor saat ini
const cursorPosition = input.selectionStart;
// Ambil nilai input tanpa "m²" dan karakter non-angka
let value = input.value.replace(/[^\d]/g, '');
// Update nilai input dengan format angka dan "m²"
input.value = value ? value + ' m²' : 'm²';
// Atur posisi kursor di depan "m²"
input.setSelectionRange(cursorPosition, cursorPosition);
}
function formatCurrency(value, isDiskon = false) {
// Ensure the value is a valid number
const numericValue = parseFloat(value);
if (isNaN(numericValue)) {
return 0;
return 0;
}
// Format the number with commas for thousands separators