Actually since forever, you don't need to use document.getElementById("x") in any case. You just by putting the id to the element, it is already available to you referencing it by such id.
So this:
document.getElementById('foo').className =
document.getElementById('foo').className.replace(/^bold$/, '');
Can become to this: foo.classList.remove("x");
And is miles away more performant than slow jQuery.