O
O
olya_0972018-02-08 00:18:17
JavaScript
olya_097, 2018-02-08 00:18:17

Why are there 2 lines in which I left a comment (almost at the very bottom)?

<style>
.alert {
  padding: 15px;
  border: 1px solid #d6e9c6;
  border-radius: 4px;
  color: #3c763d;
  background-color: #dff0d8;
}
</style>

<body>
  <h3>Сообщение пропадёт через секунду</h3>
</body>

<script>
  var div = document.createElement('div');
  div.className = "alert alert-success";
  div.innerHTML = "<strong>Ура!</strong> Вы прочитали это важное сообщение.";

  document.body.appendChild(div); // для чего это и как понять?

  setTimeout(function() {
    div.parentNode.removeChild(div); // для чего это и как понять?
  }, 1000);
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devhub16, 2018-02-08
@olya_097

1 comment - a div is created at the end of the body tag with your class and text.
2 comment - the same div is removed after 1 second.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question