Constraint input "type date"

2

Code:

<input type="date" name="data" value="">
<input type="submit" class="success round button" value=""/>

I need when I click the submit button and the date field is blank it will not let me submit. Is there any way in html even without being JS to do this restriction?

    
asked by anonymous 24.03.2016 / 15:46

1 answer

3

You can use the required attribute that is exactly to avoid sending the field empty. This functionality of the HTML5 API is supported on virtually all browsers .

It would look like this:

<input type="date" name="data" value="" required>

jsFiddle: link

    
24.03.2016 / 15:50