I am recieving measurements _date
and _time
from a device on regular intervals. When measurements arrive, I update the innerHTML
of an element using:
document.getElementById("t_001").innerHTML = `${_date}, ${_time}`;
and element with ID t_001
is changing it's value fine. Now I want to create a nice fade in fade out animation (using opacity) for the text whenever inner.HTML
is updated.
In order to do this I want to manipulate CSS of the element through a function animation()
like this:
let x = document.getElementById("t_001");
x.addEventListener("change", animation());
function animation(){
// CSS Changes will take place here but this is never triggered...
console.log(x);
}
But the function never triggers... How come?