0
<div class="container">
<div class="card-deck mb-3 text-center">
<div class="card mb-4 box-shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Lights</h4>
</div>
<div class="card-body">
<div id="relay">
</div>
</div>
</div>
</div>
</div>
This is my HTML, and I intend to add a button in the div relay
, but I don’t know how to access it with javascript.
My javascript is something like this
if(1 == 1){ //ignorem esta comparação
document.getElementById('relay').innerHTML='<button type='button' class='btn btn-lg btn-block btn-outline-danger'>OFF</button>';
}else{
document.getElementById('relay').innerHTML='<button type='button' class='btn btn-lg btn-block btn-outline-success'>ON</button>';
}
Did you manage to resolve the question? If yes, please tick the answer. Obg!
– Sam