Answers for "write a javascript code snippet to validate the password textbox length of minimum 8 characters."

0

write a javascript code snippet to validate the password textbox length of minimum 8 characters.

function validateInput (textbox) {
  const inputLength = textbox?.value?.length || 0;
  if (inputLength < 8) {
	console.log('Invalid input: minimum 8 chars required');
    document.querySelector(`label[for="${textbox.id}"]`).textContent 
    = 'Error: minimum 8 characters required.'; // Replace this with 
    										   // whatever is required as 
    										   // per your markup
  }
}
Posted by: Guest on April-16-2021

Code answers related to "write a javascript code snippet to validate the password textbox length of minimum 8 characters."

Code answers related to "Javascript"

Browse Popular Code Answers by Language