recargarBtn.addEventListener('click', async () => let phoneRaw = phoneInput.value.trim(); let amount = selectedAmount;
// Validar número Telcel (10 dígitos, empieza con 1, 2, 3, 4, 5, 6, 7, 8, 9? real: puede ser 55,56, etc) function isValidTelcelNumber(number) const clean = number.replace(/\D/g, ''); return clean.length === 10 && /^[0-9]10$/.test(clean); mi telcel recarga
<script> // Estado actual del monto seleccionado let selectedAmount = null; const amountBtns = document.querySelectorAll('.amount-btn'); const customAmountInput = document.getElementById('customAmount'); const phoneInput = document.getElementById('phoneNumber'); const recargarBtn = document.getElementById('recargarBtn'); const statusDiv = document.getElementById('statusMessage'); recargarBtn
// Seleccionar monto predefinido amountBtns.forEach(btn => btn.addEventListener('click', () => clearSelectedButtons(); btn.classList.add('selected'); selectedAmount = parseInt(btn.getAttribute('data-amount'), 10); customAmountInput.value = ''; // limpiar custom statusDiv.innerHTML = `✅ Monto seleccionado: $$selectedAmount MXN`; statusDiv.classList.remove('error-msg', 'success-msg'); ); ); async () =>
// Función para limpiar selección visual function clearSelectedButtons() amountBtns.forEach(btn => btn.classList.remove('selected'));