Im trying to finish up an assignment; here's what Im stuck at:
User input can only contain the following allowed characters
- alphabetic characters lower case (a-z) upper case (A-Z)
- apostrophe (‘)
- hyphen (-)
- Must have at least 1 alphabetic characters (a-z) (A-Z)
Note: You cannot make use of Reg Ex.
I can't really see another way of doing this without use of Reg Ex; Here what I've done so far...
function validate_name() {
var name = document.getElementById("name").value;
name = name.trim();
for (i = 0;i < name.lenght; i++) {
if (name.charAt(i) == a...I don't know what I'm doing