Skip to content

32-ValidateOTP #2

Description

@470693945

if (e.key >= 0 && e.key <= 9) {
// If the input field is not empty, it will move to the next input field
codes[idx].value = '';
//
if(idx+1<codes.length)//
{
setTimeout(() => codes[idx + 1].focus(), 10);
}
}

    // Checking if the key pressed is backspace
    else if (e.key.toLowerCase() === 'backspace') {
        // If the input field is empty, it will move to the previous input field
        if(idx-1>=0)//
        {
            setTimeout(() => codes[idx - 1].focus(), 10);
        }            
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions