0

Как переписать/дописать код, чтобы получить дату в дальнейшем использовании(сделать не локальной)?

<input type="text" name="depdate" id="depdate" >

<script>
var supDep = new Date();
var input = document.getElementsByTagName('input')[0];

input.oninput = function (){
 var  valInInput = (document.getElementsByTagName('input')[0].value.match(/\d+/g));
 supDep.setHours(valInInput[0],valInInput[1],valInInput[2],valInInput[3]);
}
</script>

1 ответ 1

0

var currentValue;
document.getElementById('depdate').oninput = function (){
  // this - измененный инпут:
  currentValue = this.value;
  console.log(currentValue);
};
<input type="text" name="depdate" id="depdate" >

1
  • Как сделать так, что бы достать дату из локальной переменной во внешний код?
    – S7uel _
    24 сен 2018 в 16:35

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.