I have some text 'foo', which uses a gradient to colour it. I want to update this text to 'bar', but when I do this, the text stays the same until I highlight it, when it then changes. A jsfiddle with example code is here. Can anyone figure out how to make it so it does update? Note: The current gradient code only works in Chrome
HTML:
<div id="gradient_div">
<p id="gradient_text" onload="update">
Foo
</p>
</div>
CSS:
#gradient_div
{
background: linear-gradient(#000000,#ffffff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
Javascript:
setTimeout(function(){
document.getElementById("gradient_text").innerHTML="bar";
},500);