I'm trying to fill a text input using a URL parameter: http://127.0.0.1/index.html?uname="john"
<p class="control">
<input autofocus id="uname" class="input"
onchange="(sayhello(this.value))"
oninput="sayhello(this.value)"
placeholder="Enter your name" type="text">
</p>
I use the following script to pass the URL parameter into text input but the events don't work, they works only if I delete the input text and type it.
<script>
var uunme = window.location.href.match(/\?uname=(.*)/);
document.getElementById("uname").value = uunme[1];
</script>