I have the following code
//main.js
var textinput = document.getElementById('textinput').value;
function textChanger() {
setTimeout(function() {
textinput = 'newtext';
}, 3000);
}
<!doctype html>
<html>
<head>
<title> some title </title>
</head>
<body>
<input type="text" value="sometext" id="textinput" oninput="textChanger()">
<script type="text/javascript" scr="main.js"></script>
</body>
</html>
I expect that the value of textinput should be changed after 3 seconds but it isn't changing.