+ 1

How to use a link at the bottom of the output of this web code?

I am creating a code which shows the current time , date and day by using Date object of js and I want to insert a link at the bottom of the page. I can't do this because I am using the setInterval function and document.body.innerHTML to show the time which makes the link disappear a after 1 second. Please tell how to insert the link. This is my code | | \/ https://code.sololearn.com/W11Gpo3DbVRD/?ref=app

27th Mar 2020, 10:40 AM
Vasu Vijay
Vasu Vijay - avatar
1 ответ
+ 4
Instead of changing innerHTML of body use a div(or any other tag) and select it using DOM selector methods. then change it's innerHTML. for example : use this in html <div id="time"></div> and then update that tag in js: document.querySelector('#time') .innerHTML = "some text here";
27th Mar 2020, 10:48 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar