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
In the DOM, the class of an element is just each class separated by a space. You would just need to implement the parsing logic to insert / remove the classes as necesary.
I wonder though... why wouldn't you want to use jQuery? It makes this kind of problem trivially easy.