Force that the date selected in an input type date can not be less than the current date

1

I was wondering what I could do to validate that the selected date in a <input type="date>" can not be less than the current date. I am currently using this input:

<input type="date" class="form-control" name="fecha" id="fecha"  placeholder="Introduce una fecha" required/>

I hope someone can throw a cable, greetings.

    
asked by Hechi 24.05.2016 в 13:44
source

2 answers

3

You can set the min property so that, in browsers that show calendars to select the date, it will not allow you to select a date before this.

However, you can always enter it manually. If you want to make sure that you do not enter a previous value you should use a date plugin or create your validation function in javascript.

<input type="date" class="form-control" name="fecha" id="fecha"  placeholder="Introduce una fecha" required min="2016-05-24"/>
    
answered by 24.05.2016 / 13:51
source
1

You do not say it explicitly, although I think you're looking for a solution for

answered by 24.05.2016 в 15:11