SOURCE

console 命令行工具 X clear

                    
>
console
document.querySelector('#one input').onkeyup = function() {
    document.querySelector('#one span').innerHTML = this.value;
}
document.querySelector('#second input').onkeyup = function() {
    setTimeout(function() {
        document.querySelector('#second span').innerHTML = document.querySelector('#second input').value;
    }, 0);
}
<p>未使用setTimeout函数</p>
<p id="one">
    <input type="text" id="input" value="">
    <span></span>
</p>
<p>使用setTimeout函数</p>
<p id="second">
    <input type="text" id="input" value="">
    <span></span>
</p>