There is a code that updates every 5 seconds. Div # result displays the cost value. How to make it so that if the value grows, the text becomes green, and if it drops, then it goes red.
var reloadData = function() { $.getJSON('https://api.cryptonator.com/api/ticker/ltc-usd', function(data){ var float = parseFloat(data.ticker.price).toFixed(2) $('#result').text(float) }) } setInterval('reloadData()', 5000) $(document).ready(reloadData) <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="result">Loading...</div> Example here