function validate() {
//Make a selector pointing to your input first
var myInput = document.getElementById('yourInputId').value
//Validate length:
if (myInput.length >= 8) {
//Check for age
if (eval(myInput) >= 16) {
alert('your input is ok!');
}
else {
alert('Minimum age is 16!');
}
}
else {
alert('input too short!');
}
}
P.S.: For character exclusion you should jump into Regular Expressions
(Tons of example on the web, just Google it!)
1
solved Need help Javascript validation input text and date [closed]