const regExpName = /[a-z]{3,16}/i;
if (element.value.trim()) {
switch(element.name) {
case 'name':
const name = element.value.match(regExpName);
console.log(name)
}
} else {
element.classList.add('error');
return element;
}
const regExpName = /[a-z]{3,16}/i;
if (element.value.trim()) {
if (element.name === name) {
const name = element.value.match(regExpName);
console.log(name)
}
} else {
element.classList.add('error');
return element;
}