How can i put a time using js without losing the contents of my html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i put a time using js without losing the contents of my html

need help... when I'm using the code at the tutorials the contents disappear when the millisecond move....

10th Feb 2017, 2:15 PM
Noel Blanco
Noel Blanco - avatar
1 Answer
+ 1
document.getElementById('anIdOfYourHtmlDocument').innerHTML 'innerHTML' is a property of all html element, wich can be read/write accessed, accepting and parsing html code: <body> <div>un div</div> <div id="myDiv">I want write only here</div> </body> document.getElementById('myDiv').innerHTML='<h1>I can put <b>complex</b> structured html stuff inside any container</h1>'; document.getElementById('myDiv').innerHTML+='<p>as well as appending stuff... but in this case, all the html string is reparsing ( modified elements would be resetting</p>';
10th Feb 2017, 3:36 PM
visph
visph - avatar