Я создаю окно с предупреждением с помощью начальной загрузки
<!DOCTYPE html>
<html>
<head>
<link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
</head>
<body>
<div class = "alert alert-info alert-dismissible fade show">
Alert <a href = "#" class = "alert-link">Read this message</a><button class = "close" data-dismiss = "alert"> Close </button>
</div>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</body>
</html>
Этот код работает таким же образом, если я удаляю класс предупреждения о недопустимости для div. Если нет никаких изменений даже после удаления объявления класса «предупреждение-несоответствие», то какова польза от класса «предупреждение-несоответствие»? Поле предупреждения является недопустимым, даже если окно предупреждения не имеет класса недопустимое предупреждение. Почему?






Следующее из Bootstrap Веб-сайт
Using the alert JavaScript plugin, it’s possible to dismiss any alert inline. Here’s how:
- Be sure you’ve loaded the alert plugin, or the compiled Bootstrap
- JavaScript. If you’re building our JavaScript from source, it requires util.js. The compiled version includes this.
- Add a dismiss button and the .alert-dismissible class, which adds extra padding to the right of the alert and positions the .close button.
- On the dismiss button, add the data-dismiss = "alert" attribute, which triggers the JavaScript functionality. Be sure to use the element with it for proper behavior across all devices.
- To animate alerts when dismissing them, be sure to add the .fade and .show classes.
прочтите здесь, что такое предупреждение, а какое - отключенное. Чтобы получить ответ, просто выполните быстрый поиск в Google по запросу "предупреждение о начальной загрузке отключено".