+ 1
JavaScript
how to interact with a form using JavaScript?
5 Answers
+ 3
You can put "required" on your input to prevent form submission if the field is empty.
<input type="text" name="myinput" required>
Otherwise, if you want to personalize your input validation, see here:
https://www.w3schools.com/js/js_validation.asp
+ 1
What do you want to do with the form?
+ 1
I just want , if for example a user doesn't insert something in a field , show him a alert like "the field is empty".
+ 1
an alert message like " the name field is empty"
+ 1
thanks brother!