var a = document.createElement('input')
a.value = 222
a.setAttribute('type', 'text')
a.setAttribute('autofocus', 'autofocus')
document.body.appendChild(a)
setTimeout(function () {
document.body.removeChild(a);
setTimeout(function () {
document.body.appendChild(a)
},5000)
},3000)
function clickHandler() {
var b = document.createElement('input')
b.setAttribute('type', 'text')
b.setAttribute('autofocus', 'autofocus')
document.body.appendChild(b)
}
<button onclick="clickHandler()">t</button>