0
HTML Forms: Confused with the required attribute.
<form method="post" action=""> <input type="text" required> <button type="submit">submit</button> </form> I have a code like this with method ="post". I'm confused about the required attribute. Which one is true in this code? 1. "Required" attribute will check if the text field is empty on the server side when the form is submitted. 2. "Required" attribute will check if the text field is empty on the client side when the form is submitted. 3. submit button can be clicked even if the text field is empty.
2 odpowiedzi
+ 4
Number 2
0
2. The "required" attribute demands a value in the input text field or in which input field he's applied to.
If the input field stays empty on the client side the form will not be submitted.
NO text (value) = NO submit