You can just add input to DOM like <input type="text" id="tag">
and save
javascript as window.onload = function () {
document.getElementById('tag').value = 122;
};
This will do your job.
OR While keeping your code, you can do it like below:
HTML:
<div id="tag"></div>
JS:
<script type="text/javascript">
window.onload = function(){
document.getElementById('tag').appendChild(text);
}
</script>
Bhushan firake
source
to share