I am looking to animate the text, "This is NOT allowed" below.
document.getElementById("ve").innerHTML = '<p style="text-align:center"><h1><span style="color:blue">This is </span><span style="color:red">NOT allowed</span><span style="color:blue">. </span></h1></p>';
Unfortunately my situation is I have to use innerHTML in a java script. There is no HTML page. A java script dynamically generates HTML so I dont have access to HTML page. I want to animate the text either fade-in or some simple bounce. Because it is a javascript file I dont have access to css file (or am I wrong?). I am looking for less code and very simple mechanism.One idea is I can simulate blinking by copy-pasting showing innerHTML, setting it to "", and showing again every 1 second. Is there any elegant way? I cannot use any javascript framework like jQuery.
Note*: I copy pasted the code to assign the value to innerHTML, and set it to "" every 2 seconds, the blinking effect is not happening. So that option is ruled out, I guess. Am a UI nube with extensive backend experience :(
Edit** I have decided to go with @JoshB answer. It works and is much cleaner. The HTML tags and animation are clearly separated. I am targeting people with some medical conditions. Me being a 0/10, I want simpler dumbed down solution. Thanks for your help.