below is a javascript code I want to call the script on page load.
<select onchange = "displayDate()">
<option value='option1'>Gateway 1</option>
<option value='option2'>Gateway 2</option>
<option value='option3'>Gateway 3</option>
</select>
<p id="demo"></p>
I want to call below script in select which is called on page load. I am using onchange right now which call the script when i select an option.
<script>
function displayDate() {
document.getElementById("demo").innerHTML = Date();
}
</script>
Is there any way in which the script is called every time on page load?