+ 2

How to place the output of a code in an container tag

i want place this output of this code in a container tag function printTime() { var d = new Date(); var hours = d.getHours(); var mins = d.getMinutes(); var secs = d.getSeconds(); document.body.innerHTML = hours+":"+mins+":"+secs; } setInterval(printTime, 1000);

21st Jan 2018, 1:21 PM
Gautam Kumar
Gautam Kumar - avatar
1 Answer
+ 1
store hours, minutes and secs varibles in a new variable named time then put it in the container
21st Jan 2018, 5:26 PM
Shakir Dodhiya
Shakir Dodhiya - avatar