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
Well you just need to use document.getElementById('hello').setAttribute('class', 'someclass');
.
Also innerHTML
can lead to unexpected results! Consider the following;
var myParag = document.createElement('p');
if(under certain age)
{
myParag.text="Good Bye";
createCookie('age', 'not13', 0);
return false;
{
else
{
myParag.text="Hello";
return true;
}
document.getElementById('hello').appendChild(myParag);