I have been setting up files to demonstrate form validation to myself. However I've found that the script doesn't check wether or not the name field is valid or not, could someone please tell me where I've went wrong?
<!DOCTYPE html>
<html>
<head>
<script>
function kValForm() {
var n = document.forms["kForm"]["kName"].value;
...
if( n == null || n == " " || n ="") {
alert("Please fill in your name.");
return false;
}
...
}
</script>
</head>
<body>
<form name="kForm" onsubmit="kValForm()">
Name: <input type="text" name="kName" placeholder="Khalifa">
<br/>
...
<br/>
<input type="submit">
</form>
</body>
</html>
The ellipses are removed bits of code that are irrelevant and take up lots of space. But the code above sends the name form even if it's empty, why?