Start Validating form fields using javascript

Validating form fields using javascript

It can prevent people from leaving fields blank, from entering too little or too much or from using invalid characters.

I have been using it for my last few projects and it is pretty nice.

The reason your current code doesn't work is because you don't have a FORM tag in there.

Also, lookup using "name" is not recommended as its deprecated.