I am trying to change background of div tag continuously using for loop and rgb() values . following is my code written in sample.html:
Everything seems fine besides the code where you set the CSS.
Change the code :
$("#sqr").css("background-color","rgb(r,g,b)");
To :
$("#sqr").css("background-color","rgb(" + r + "," + g + "," + b + ")");
This will now pass in the number values, i.e.
$("#sqr").css("background-color","rgb(254,254,254)");
Where as before it would have simply passed the values r,g,b because you placed them within a string.