I have a function that checks the age of a form submission and then returns new content in a div depending on their age. Right now I am just using getElementById to replace
If the element has no class, give it one. Otherwise, append a space followed by the new className:
var el = document.getElementById('hello'); if(el) { el.className += el.className ? ' someClass' : 'someClass'; }