I have the following code that I took off from a plugin. I have very less experience and knowledge with JavaScript. I am trying to delay the change of text in html. Here's what the code i have:
function printResult() {
var res;
var blah="OKAY B****!";
if(win[a.pos] === win[b.pos] && win[a.pos] === win[c.pos]) {
res = "You Win!";
} else {
res = "You Lose";
}
$('#result').html(res);
if(res=='You Lose'){
setTimeout($('#result').html(blah),3000);
}else{}
}
The text in #result changes but it changes instantly without the delay.