Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<div class="toast toast-success" id='status-color'>
  <button class="btn btn-clear float-right" id='start-stop-button'>START!</button>
  <span id='status-text'>Retrieving status...</span>
</div>
// где-то в фетче статуса

var statusToastEl = document.getElementById('status-color');
var statusTextEl = document.getElementById('status-text');
var runButtonEl = document.getElementById('start-stop-button');


if(!running) {
  statusToastEl.className = 'toast toast-error';
  statusTextEl.innerHTML = 'NOT RUNNING';
  runButtonEl.style.display = 'block'; // показываем кнопку
} else {
  statusToastEl.className = 'toast toast-success';
  statusTextEl.innerHTML = 'RUNNING';
  runButtonEl.style.display = 'none'; // прячем кнопку
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment