How do I do HTML form validation using Java Script?

Asked by Last Modified  

Follow 2
Answer

Please enter your answer

"Rajesh Kumar N: Guiding Young Minds from 1 to 12 with Expertise and Care"

Use the onsubmit event and JavaScript: <form onsubmit="return validateForm()"> <input type="text" id="name" placeholder="Enter Name"> <input type="email" id="email" placeholder="Enter Email"> <button type="submit">Submit</button> </form> <script> ...
read more
Use the onsubmit event and JavaScript: <form onsubmit="return validateForm()"> <input type="text" id="name" placeholder="Enter Name"> <input type="email" id="email" placeholder="Enter Email"> <button type="submit">Submit</button> </form> <script> function validateForm() { let name = document.getElementById("name").value; let email = document.getElementById("email").value; if (name === "" || email === "") { alert("All fields are required!"); return false; } return tru e; } </script> read less
Comments

Related Questions

How do I learn Java? From book or internet or a coaching?
According to me....u should start from basic Java..that is core Java... . Find coaching , who teaches Java for beginners.....then later u can go for advance java.
Suresh
0 0
7

I am a fresher and I want to become a Java developer, so what is necessary to crack the Java interview ? 

Hi Dipesh, understand that Java is a kind of ocean. It is vast. For interview preparation, you can brush up your Core Java Concepts and OOPs concepts and understand how JAVA works and learn the java features...
Dipesh
What are the most important topics in Java interviews for a fresher?
Exception handling, String, Collections, OOPs concept, multithreading
Advaith
0 0
6
Why string objects are immutable?
Strings are immutable once created cannot be changed and hence cannot be eliminated but string builders are mutable.
Sujatha

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Method Overloading vs Method Overriding
1. Method Overloading: Method overloading means a same method with same name can have different implementations/body by changing one of the follwing thing: 1) Number of Parameters 2) Order of Parameters 3)...

Importance of Constructor's Visibility.
While developing program or implementing Singleton pattern we have learnt to mention constructor as private and known reason is -> to blocked its direct call from outside of class. But did we think...

Implementation: What Is JPA And JPA?
The basic Java framework to access the database is JDBC. Unfortunately, with JDBC, a lot of hand work is needed to convert a database query result into Java classes. JPA allows us to work with Java classes...

Crux Of The Basic Interview Question Asked Around It Professionals
Question: Explain PSVM() in Java. Answer: This question is asked from a differnet persctive. Person asking this question is looking for deep java concepts. If answer in your mind is something like...

What is a Programming Language
What is a Language? Language is a communication system of human. What is a programming Language? A programming Language is a formal constructed language design to communicate...

Recommended Articles

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Before we start on the importance of learning JavaScript, let’s start with a short introduction on the topic. JavaScript is the most popular programming language in the world, precisely it is the language - for Computers, the Web, Servers, Smart Phone, Laptops, Mobiles, Tablets and more. And if you are a beginner or planning...

Read full article >

Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”.  Right from its first implication as java 1.0...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you