I am trying to use this script to run a function on the page load. Can anyone see what's wrong? Stupid error, I'm sure - just can't work it out.
Code:
<script>
var text = document.getElementById("myText");
function changeFontSize(){
if (window.innerWidth < 600) {
text.style.fontSize = "70px";
} else {
text.style.fontSize = "100px";
}
}
window.onresize = changeFontSize;
</script>
<script>
setTimeout(function() changeFontSize, 3000);
</script>