0
I’m 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 red to green. That way the test would be approved.
However I am not able to connect addClass with Math.round and make it work both, other doubt, in "mouseenter" would have to be an automatic reading function, and not an event, I looked for something like and found nothing.
$(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;
}
Missing a closing parenthesis in Math.round function
– Felipe Duarte
Thanks but it still didn’t work
– Felipe Deolindo