JSFiddle - React, Tailwind, and code Playground
by David Thomas
HTML
<ul>
<li>1.3</li>
<li>1.5</li>
<li>1.6</li>
<li>2.0</li>
<li>2.9</li>
<li>3.6</li>
<li>4.6</li>
<li>6</li>
</ul>
CSS
.isInteger {
background-color: #0f0;
}
.isNotInteger {
opacity: 0.5;
background-color: #f00;
}
JavaScript
$('li').addClass(
function(i){
var num = $(this).text() * 1;
return Math.round(num) == num ? 'isInteger' : 'isNotInteger';
});