Uncaught TypeError: невозможно прочитать свойства неопределенного значения (чтение «classList»)
Код выглядит хорошо (для меня).
Кнопка запуска открывает модальное окно, заполните форму, см. ошибка. Я просматриваю консоль на вкладке "Разработчики" через Chrome.
Мой код
Код: Выделить всё
function loadSender() {
document.addEventListener('DOMContentLoaded', function() {
const cModal = document.getElementById("btnSubmit");
const modalSubmit = new bootstrap.Modal(cModal);
const xModal = document.getElementById("modalContact");
const modalLaunch = new bootstrap.Modal("xModal");
const zModal = document.getElementById("modalCheck");
const modalOpenCheck = new bootstrap.Modal("zModal");
const nameField = $(document.getElementById("txtName"));
const name = nameField.value;
const emailField = $(document.getElementById("txtEmail"));
const email = emailField.value;
const messageField = $(document.getElementById("txtMessage"));
const message = messageField.value;
callASMX(name, email, message);
//document.modalLaunch.hide;
//document.modalLaunch.reset;
//document.modalOpenCheck.show;
});
}
function callASMX(name, email, message) {
// Intent to send data to server
console.log("name: " + name);
console.log("email: " + email);
console.log("message: " + message);
}Код: Выделить всё
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
.modal-top {
background: #9aa69c
}
.modal-bg {
background: #737393
}Код: Выделить всё
Sandbox · Bootstrap v5.0
[url=#]Home[/url]
[url=#]Features[/url]
[url=#]Contact[/url]
SandBox
Lets Play
Launch
[url=https://getbootstrap.com/]Get Bootstrap[/url], by [url=https://twitter.com/mdo]@mdo[/url].
button>
Name
Email address
Your message
Send
Success
Thank You. Your Message has been Sent.
Подробнее здесь: https://stackoverflow.com/questions/797 ... modal-form
Мобильная версия