How to convert this div to input

<div id="test">test</div>

I want to convert to

<input id="test" value="test"/>

el = document.getElementById ("test");
el.setAttribute ("value", "test");

but how does div become input?

Apr.01,2022

create input and delete div;

var div = document.getElementById('test');
var ipt = document.createElement('input');
ipt.setAttribute('id','test');
ipt.setAttribute('value',div.innerText);
document.body.appendChild(ipt);
div.remove();
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36fcb-2b8a4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36fcb-2b8a4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?