I have a form with two date inputs. One of them receives the beginning of the event, and the other the end of the event. With this in mind, I'm trying to create a Javascript function that makes it impossible for the end date to be before the start date. How can I do this?
I've already looked at some answers in Stack OverFlow in English, but they have not solved the problem. My form is this:
<form name="form" action="novoevento" method="post" onsubmit="return autenticarDados()" class="form-inline">
<div class="form-group">
<label for="name">Nome do Evento:</label>
<input required="required" type="text" class="form-control" name="nome">
</div>
<div class="form-group">
<label for="dataInicio">Data de começo do evento:</label>
<input required="required" type="date" min="2017-12-01" max="2017-12-31" class="form-control" name="dataIni">
</div>
<div class="form-group">
<label for="dataFim">Data de fim do evento:</label>
<input required="required" type="date" min="2017-12-01" max="2017-12-31" class="form-control" name="dataFim">
</div>
<button type="submit" name="Registrar" class="btn btn-default">Submit</button>
</form>