function digitValidate(ele){ ele.value = ele.value.replace(/[^0-9]/g,''); } function tabChange(val){ let totalLength = 0; let ele = document.querySelectorAll('.digitInput'); ele.forEach((element) => {totalLength += element.value.length}); console.log(totalLength); let submitButton = document.querySelector('#submitButton'); if (totalLength === 4) {submitButton.disabled = false} else {submitButton.disabled = true}; if(ele[val-1].value != ''){ ele[val].focus() }else if(ele[val-1].value == ''){ ele[val-2].focus() } } const modalHTML = `
`; const tempContainer = document.createElement('div'); tempContainer.innerHTML = modalHTML; const modal = tempContainer.querySelector('.modal'); window.openOTPModal = function() { modal.style.display = 'flex'; }; window.closeModal = function() { modal.style.display = 'none'; }; document.body.appendChild(modal); var bgWhtite = document.querySelector('.bgWhite'); bgWhtite.style.cssText = 'background:transparent; border: none;';