Sorry if the title is off unsure how to word this.
I am trying to get an if/else statement to work, however it is not working for me or i am missing something. From my API I am pulled an JSON object "entity id" and the state of that id "state"
creating the entity state!
var $$ = Dom7;
$$('[entity-status="' + entity.entity_id + '"]').html(entity.state);
Above can then be used as within my HTML and will display the state! <div entity-status='switch.office_light_2'></div> the DIV will display ON
When I try to use it in an if/else statement it dose not work.
if ($("entity-status='switch.office_light_2'") === "ON") {
document.getElementById("live").innerHTML = "Success";
} else {
document.getElementById("live").innerHTML = "nope";
}
how can i get this to work? Thanks for all your help
Aucun commentaire:
Enregistrer un commentaire