Hi folks,
I’m trying to make two functions run at window.onload
. How do I make that happen. Currently, the last one takes priority over the first. I want to avoid that! I want the first function to run and then the second one to run right after.
Current javascript code:
$(document).ready(function() {
function typeWriterOne() {
alert('ok');
};
window.onload = typeWriterOne;
var i = 0;
var txt = 'Are You a Provider/Partner? Login Here';
var speed = 50;
function typeWriterOne() {
if (i < txt.length) {
document.getElementById("question-1").innerHTML += txt.charAt(i);
i++;
setTimeout(typeWriterOne, speed);
}
}
function typeWriterTwo() {
alert('ok');
};
window.onload = typeWriterTwo;
var i = 0;
var txt = 'Are You a User? Login Here';
var speed = 50;
function typeWriterTwo() {
if (i < txt.length) {
document.getElementById("question-2").innerHTML += txt.charAt(i);
i++;
setTimeout(typeWriterTwo, speed);
}
}
});