I am trying to make a script in which when a sensor that is part of the test sends me a number 5, it changes the color of the table that is in red to green. That way the test would be approved.
But I'm not able to connect addClass with Math.round and to do both, another question, in the "mouseenter" would have to be an auto-read function, not an event, I looked for something like that and did not find anything.
$(function(){
$('#sensorValor').mouseenter(function () {
roundedValue = Math.round(parseFloat(sensorValor) *100 / 100;
if((roundedValue >=5) && testEnable){
$('sensorValor').addClass('bad_3');
})
});
.bad_3{
border: 10px solid green;
}