Untitled
unknown
plain_text
3 years ago
798 B
40
Indexable
<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
/* let x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}*/
let x=document.getElementsByTagName(input type="text")
for(let i=0;i<x.length();i++)
{
if x[i]==""
{
alert("not filled");
return false;
}
}
}
</script>
</head>
<body>
<form name="myForm" action="" onsubmit="return validateForm()" method="post">
Name: <input type="text" name="fname">
Age:<input type="text" name="age">
<input type="submit" value="Submit">
</form>
</body>
</html>
Editor is loading...