H4 does not change the inner

im learning js and im making a program that change the inner of a h4 changing it for the value of a input, but when I press the button that changes the inner the h4 is empty.

https://i.stack.imgur.com/sTn87.png

https://i.stack.imgur.com/BH8DZ.png

https://i.stack.imgur.com/3okCU.png

This is my code:

document.addEventListener('DOMContentLoaded', () => {
    const h4 = document.getElementById('h4');
    const button = document.getElementById('button');
    let input = document.getElementById('input').value;
    button.onclick = () => h4.innerHTML = input;
});

Source: Windows Questions

LEAVE A COMMENT