-1
I have two input date created, and would like to take 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 catch it shows the code and not the value
JS
function botaoFunfa() {
    var teste = document.querySelector("#datetimepicker6");
    console.log(teste);
}
I managed to get the amount as follows:
I was able to solve it this way:
function botaoFunfa() {
    var teste = document.querySelector(".switch");
    var StringData = teste.textContent || teste.innerText; 
    console.log(StringData);
}
So it shows the day, month and year. Obs.: the switch class is the bootstrap itself.
But for some reason it’s giving some bug, and it doesn’t get both input date, just one.
try with
var teste = document.querySelector("#datetimepicker6").value;– BrTkCa
I managed to solve by pulling the switch class, but it does not catch both and error
– Maria
datetimepicker6does not own a propertyvalue, note that theidis in adiv, if you want to get thevalueof a single elementinputfor hisid. You should first inform theidin HTML.– Caique Romero