javascript - Change colour of text based on a value of another div element, Jquery, html and css? -
i want change color of text, based on value of div element. need run every second setinterval has go in there where
something this:
<div class="abcd">jkl</div> <div class="xyz">7</div> if("xyz" <10){ //change "abcd" "abcd2" changes color}
i'm not @ jquery think thats tool needed job.
setinterval(function() { var text = $(".xyz").text(); if (parsefloat(text) < 10) { $(".abcd").addclass("abcd2").removeclass("abcd"); } }, 1000); //run after every 1 second
Comments
Post a Comment