0
How do I recover input data value? My goal is value to match the date selected in the field.
Filter field:
<div class="filt-nam">
<h5>Filtrar Itinerários por Data: </h5>
</div>
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group">
<input type="date" class="form-control" id="dataInicio" value="" />
<input type="date" class="form-control" id="dataFim" value="" />
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" onclick="filtrarData()">Filtrar</button>
</div>
</div>
</div>
JS file:
function filtrarData() {
let dataInicio = document.getElementById('dataInicio')
let dataFim = document.getElementById('dataFinal')
console.log(dataInicio.value, dataFim.value)
};
You switched
dataFim
fordataFinal
.– Sam
The end, what is the real purpose of the question? Is to correct the error of a single field, such as the Sam mentioned and the André Filipe responded or format the field, such as the Luiz Felipe answered? What is the error? What happens unexpectedly? You should aim to avoid questions like "kick"...
– LipESprY
Let’s wait for the answer from Felipe Noka.
– RXSD