//app.js let form2=document.getElementById("form"); let userName2=document.getElementById("userName"); form2.addEventListener("submit",(e)=>{ e.preventDefault(); validateInputs(); }) function validateInputs(){ let userNameVal=userName2.value.trim(); if(userNameVal === ""){ setError(userName2,"user name is required"); } else{ setSuccess(userName2); } } function setError(element,message){ let inputGroup=element.parentElement; let errorElement=inputGroup.querySelector("small"); errorElement.innerText=message; inputGroup.classList.add("error"); inputGroup.classList.remove("success"); } function setSuccess(element){ let inputGroup=element.parentElement; let…