I have two input date created, and I would like to get the date of the two by a button.
<div class='col-md-5 col-lg-4'>
<div class="form-group">
<span>Inicio</span>
<div class='input-group date' id='datetimepicker6'><span></span>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<!-- -->
<div class='col-md-5 col-lg-4'>
<div class="form-group">
<span>Fim</span>
<div class='input-group date' id='datetimepicker7'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<!-- -->
<div class="col-md-5 col-lg-3">
<div id="espaco"></div>
<button type="button" class="btn btn-primary" data-toggle="button" aria-pressed="false" autocomplete="off" onclick = "botaoFunfa>
Buscar
</button>
</div>
Every time I try to get it it shows the code and not the value
JS
function botaoFunfa() {
var teste = document.querySelector("#datetimepicker6");
console.log(teste);
}
I was able to get the value as follows:
I was able to resolve it as follows:
function botaoFunfa() {
var teste = document.querySelector(".switch");
var StringData = teste.textContent || teste.innerText;
console.log(StringData);
}
So he would show the day, month and year. Note: the switch class is bootstrap itself.
But for some reason it's giving a bug, and it does not take the two input dates, just one.