Answer the question
In order to leave comments, you need to log in
Entering text into input does not change value. How to fix?
There is an input field:
I'm trying to get the entered value using:
(All this, of course, is inside a function that is a handler for changing the input)<input id="datetime_from" type="text">
let input = document.getElementById("datetime_from");
let result = normalizer(input.value);
let normalizer = function (date) {
let res = /(\d\d).(\d\d).(\d\d\d\d)/.exec(date);
if (!res)
return '';
let normalized = `${res[3]}-${res[2]}-${res[1]} 00:00:00+03:00`;
return normalized;
};
console.log(document.getElementById("datetime_from").value)
<input id="datetime_from" type="text">
Answer the question
In order to leave comments, you need to log in
Maybe replace let with var?
Then maybe see what happens without the normalizer()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question