dimanche 2 avril 2017

Why this jquery else if statements are not working?

Dears,

Could you please take a look at this? It does not work, can not figure out why:

$(document).ready(function(){
        var result = parseInt($('#kmi').text()); 
        if(result<18,5){
                $("#line1").css("background-color", "#eee");
        }else if(result>=18,5 && result<24,9){
                $("#line2").css("background-color", "#eee");
        }else if(result>=25 && result=<29,9){
                $("#line3").css("background-color", "#eee");
        }else if(result>=30 && result=<34.9){
                $("#line4").css("background-color", "#eee");
        }else if(result>=35 && result=<39.9){
                $("#line5").css("background-color", "#eee");
        }else if(result>=40){
                $("#line6").css("background-color", "#eee");
        }else{
                $("#line1").css("background-color", "#fff");
        }
                
        }
});

Aucun commentaire:

Enregistrer un commentaire