1
When trying to return the value of $("#datepicker-range").val()
at the beginning of the code, console
gives me a value emptiness. Soon, I was suggested to make a Sniffer page because the reason the field is not capturing the field date would be due to an issue in the order of operations in the code reading.
$(function(){
startSelectors();
var datepickerVerify = setInterval(function(){
if($("#datepicker-range").val()){
clearInterval(datepickerVerify);
var vl = $("#datepicker-range").val();
console.log('value returned: '+vl);
}
return vl;
}, 50);
//verificando o valor da variavel
console.log('datepicker=> '+datepickerVerify);
});
function startSelectors(){
$("#datepicker-range").val('2017-03-01 até 2017-08-02');
};
And just below follows how the console is returning my code (I point out that the field is working perfectly and features that same date on the front end)
Instead of returning the date in the middle log, as it was returned inside the if
, he returns me a true
(number 1). How can I set the variable value datepickerVerify
instead of true
, return me to date?