Uncaught TypeError: Cannot read Properties of undefined (reading 'classList')
Code sieht gut aus (für mich).
Die Startschaltfläche öffnet das Modal. Füllen Sie das Formular aus, siehe Fehler. Ich zeige die Konsole im Entwickler-Tab über Chrome an.
Mein Code
Code: Select all
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);
}Code: Select all
.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
}Code: Select all
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.
Mobile version