http://jsfiddle.net/kM8xE/2/
If I have the div
s
<div class="value">15</div>
<div class="value2">20</div>
and jQuery
var actual = $(".value").html();
var comparison = $(".value2").html();
how can i add class .isbetween
to .value2
if it's html value is between +/-10 of the html for .value
ie. for this eg. a value between 5 and 25.
I am not too good but i have tried and it doesn't work.
if(parseInt(actual)-10 <= parseInt(comparison) <= parseInt(actual)+10){
$(".value2").addClass("isbetween");
}