In this example:
<div class="test">Lorem Ipsum </div>
<div class="test">Lorem Ipsum </div>
<div class="test">Lorem Ipsum </div>
<button onclick="test();"> click</button>
function test()
{
$('.test').css("color", "#0f0");
for(i=0; i<=1000000000; i++)
{
}
}
https://jsfiddle.net/t741kz5a/2/
Why does the loop run before the color is changed? And how can I make it work sequentially?