I need to find the numeric value inside a div and add a class accordingly. How do I find the numeric value? This seems to only return class of ‘medium’ so far.
<h4 class="days">Over <span class="filterUrgency">71</span> Days</h4>
$('.days').addClass(function() {
if ($('.filterUrgency').val() >100) {
return 'urgent';
} else {
return 'medium';
}
});
or
$('.days').addClass(function() {
var number = parseInt($('.filterUrgency').text());
if (number >100) {
return 'urgent';
} else {
return 'medium';
}
});
You can do as following :
This solution is better :