I searched and found that suggestion contains use . that won't work in my case.
<html>
<head>
</head>
<body>
<script>
function datafill(){
document.getElementById("text1").value="choco";
}
</script>
<form onload="datafill()">
<input type="text" id="text1">
</form>
</body>
</html>