To emulate the loading percentage effect , I need the browser display the number of percentage in real time. I have found the the methods of jQuery like html() or text() could do it well, but I would like use native JS to do it . And the problem is in Safari……
How could I make Safari update the text in real time like in Chrome. I have test the properties of textContent/innerHTML/innerText ,and the methods of manipulating nodes like appendChild/replaceChild,etc. They all doesn't work in Safari ,but normal in Chrome.
I have made a simple demo ;
when you open the demo in Chrome , the number will change with the steps of "for"circulation(from 0 to 3) , but the Safari will directly display the last result(3).
I am a newbie in web development , I don't know whether I express myself clearly.Thanks.
The following is my code:
HTML:
<div id="input_num">0</div>
JS:
var input_num = document.getElementById("input_num");
for(var i = 1;i<4;i++){
input_num.replaceChild(document.createTextNode(i),input_num.firstChild);
alert(i);}