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
}
}