I'm having trouble getting this to work...it just replaces the entire page with the result
var str="textiwanttoreplace";
var el = document.getElementById('welcome');
el.innerHTML = str;
var date = new Date();
var hours = date.getHours();
if (hours >= 8 && hours < 13) {
el.innerHTML = str.replace("textiwanttoreplace", "It's 8 and 13");
} else if (hours >= 13 && hours < 18) {
el.innerHTML = str.replace("textiwanttoreplace", "It's 13 and 18");
} else if (hours > 18 && hours <= 23) {
el.innerHTML = str.replace("textiwanttoreplace", "It's 18 and 23");
} else {
el.innerHTML = str.replace("textiwanttoreplace", "Hello");
}
edit: changed, and now I'm not seeing any results am I missing something?