rut maximo caracteres

This commit is contained in:
2026-03-21 22:04:38 -03:00
parent 1780572095
commit c377363943

View File

@@ -26,6 +26,7 @@
name="rut" name="rut"
id="rutInput" id="rutInput"
placeholder="12.345.678-9" placeholder="12.345.678-9"
maxlength="12"
required required
autofocus> autofocus>
</div> </div>
@@ -45,6 +46,11 @@
<script> <script>
document.getElementById('rutInput').addEventListener('input', function(e) { document.getElementById('rutInput').addEventListener('input', function(e) {
let value = this.value.replace(/[^0-9kK]/g, '').toUpperCase(); let value = this.value.replace(/[^0-9kK]/g, '').toUpperCase();
if (value.length > 9) {
value = value.slice(0, 9);
}
if (value.length > 1) { if (value.length > 1) {
let body = value.slice(0, -1); let body = value.slice(0, -1);
let dv = value.slice(-1); let dv = value.slice(-1);