dimanche 2 juin 2019

Change variable text colour

I'm very new to this, so forgive me if I'm not saying this correctly.

I'm calling an API that gives the status of a train service. It displays the status as "Good Service, Minor Delays, Suspended etc)

I have it working, but I want to have an if else statement that says if Good service, then leave the font colour as is, but any else - make it a different colour. Below is the code I have

var statuswaterloo = value.lineStatuses[0].statusSeverityDescription;
console.log(statuswaterloo);

$('.statuswaterloo').text(statuswaterloo);

if (statuswaterloo = "Good Service") {} 

else {
color: red;
}

Aucun commentaire:

Enregistrer un commentaire