Переменная отображается как null
Не видит переменную list
new_input.addEventListener("keydown", function keypress(key){
if (key.keyCode == "13") {
second_p.innerHTML = new_input.value;
let hide = document.getElementById('new_input');
hide.style.display = 'none';
let add = document.createElement('input');
add.id = 'second_input';
second_div.appendChild(add);
let third_div = document.createElement('div');
third_div.id = 'third_div';
container.appendChild(third_div);
let third_input = document.createElement('input');
third_input.id = 'third_input';
third_input.placeholder = 'add a list';
third_div.appendChild(third_input);
};
let list = document.getElementById(second_input);
console.log(list);
Ответы (1 шт):
Автор решения: Igor
→ Ссылка
let list = document.getElementById('second_input');
И вызывать это надо после выполнения обработчика.