make the code on the bottom insted of having a saying "invalid" ontop of the screen have it say invalid under the box example in the image below also make its say that after i press the submite button function validate() { if (!validateVal(document.getElementById("number").value)) { alert("Please Enter the number"); return; } var num = parseInt(document.getElementById("number").value); if (num < 1 || num > 9) { alert("Enter a number between 1 and 9(Including 1 and 9)"); return; } if (!validateVal(document.getElementById("name").value)) { alert("Please Enter the Name"); return; } if (!validateVal(document.getElementById("email").value)) { alert("Please Enter the Email Adderss"); return; } if (!ValidateEmail(document.getElementById("email").value)) { return; } if (!validateVal(document.getElementById("Phonenumber").value)) { alert("Please Enter the Phone Number"); return; } if (!validateVal(document.getElementById("CardNumber").value)) { alert("Please Enter the Card Number"); return; } if (!validateVal(document.getElementById("CardExpDate").value)) { alert("Please Enter the Card Expiration Date"); return; } if (!validateVal(document.getElementById("CardCVV").value)) { alert("Please Enter the Card CVV"); return; } if (!validateVal(document.getElementById("Address").value)) { alert("Please Enter the Address"); return; } alert("Validation Success"); } function validateVal(val) { if (val != null && val != undefined && val != "") { return true; } else { return false; } } function ValidateEmail(mail) { if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) { return (true) } alert("You have entered an invalid email address!") return (false) } Submit
make the code on the bottom
insted of having a saying "invalid" ontop of the screen have it say invalid under the box
example in the image below
also make its say that after i press the submite button
function validate() {
if (!validateVal(document.getElementById("number").value)) {
alert("Please Enter the number");
return;
}
var num = parseInt(document.getElementById("number").value);
if (num < 1 || num > 9) {
alert("Enter a number between 1 and 9(Including 1 and 9)");
return;
}
if (!validateVal(document.getElementById("name").value)) {
alert("Please Enter the Name");
return;
}
if (!validateVal(document.getElementById("email").value)) {
alert("Please Enter the Email Adderss");
return;
}
if (!ValidateEmail(document.getElementById("email").value)) {
return;
}
if (!validateVal(document.getElementById("Phonenumber").value)) {
alert("Please Enter the Phone Number");
return;
}
if (!validateVal(document.getElementById("CardNumber").value)) {
alert("Please Enter the Card Number");
return;
}
if (!validateVal(document.getElementById("CardExpDate").value)) {
alert("Please Enter the Card Expiration Date");
return;
}
if (!validateVal(document.getElementById("CardCVV").value)) {
alert("Please Enter the Card CVV");
return;
}
if (!validateVal(document.getElementById("Address").value)) {
alert("Please Enter the Address");
return;
}
alert("Validation Success");
}
function validateVal(val) {
if (val != null && val != undefined && val != "") {
return true;
} else {
return false;
}
}
function ValidateEmail(mail) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) {
return (true)
}
alert("You have entered an invalid email address!")
return (false)
}
<form id="result" action="#">
<input type="text" placeholder="Choose from item 1-9">
<input type="text" placeholder="Name">
<input type="email" placeholder="E-mail@gmial.com" id="email">
<input type="text" name="Phone-Number" placeholder="Enter Your Phone Number" class="number">
<input id="Card Number" type="text" placeholder="Card Number">
<input id="Card Exp Date" type="text" placeholder="Card Exp Date">
<input id="Card CVV" type="text" placeholder="Card CVV">
<input id="Address" type="text" placeholder="Address">
<div class="sub"> <a href="#" value="Check" class="check" button> Submit</a></div>
</form>
![Please enter a valid](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F49a17450-4420-43a9-94ad-62a7af8831fd%2F4a9ea82d-7814-410f-8404-55c82dc7444b%2Ff5ilbpv_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)