hey I know I may seem like a complete fool for asking this question but I truly have never known and nothing I find helps me. I have this string generated using javascript and I want to append it to my existing web page on the fly. I’ve used document.write(); or just document.getElementbyId(”).append(); and I just can’t get it to append the document to my selected id…
I have:
<p><div id='dT'>Bienvenido, Hoy es :: <div id='fecha' class='reloj'></div></div></p>
and I want to append the resulting string after the ::
The js is in a separate file but it starts working onload.
Edit to answer
I hadn’t, but I just tried, still nothing happen, not even an error =/ this is what I did:
x = Hoy + ' ' + es + ' dia ' + dia + ' del ' + yr; document.getElementbyId('dT').innherHTML += x;
Seems that you have some typos, JS is case sensitive, the correct function name is
getElementById(uppercase ‘B’) and you have to set theinnerHTMLattribute not ‘innherHTML’: