Ich habe jetzt das viel verrändert. Beide kombiniert aber es gibt ein Fehler mit Countdown die Ich nicht finden kann. Können Sie bitte mir dabei helfen?
Hier ist den test link für die relevante Seite:
https://www.soscisurvey.de/sfv_media/?act=wlwADDiLsDpptpolc2PplEVO
Und hier ist das Code wenn das hilft:
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
const nextButton = document.getElementById("submit0"); // SoSci default Weiter button
if (!nextButton) return;
// Create placeholder div to show countdown text in place of button
const timerPlaceholder = document.createElement("div");
timerPlaceholder.style.display = "inline-block";
timerPlaceholder.style.textAlign = "center";
timerPlaceholder.style.fontWeight = "bold";
timerPlaceholder.style.backgroundColor = "#ccc";
timerPlaceholder.style.color = "#666";
timerPlaceholder.style.borderRadius = "5px";
timerPlaceholder.style.padding = "10px";
timerPlaceholder.style.width = nextButton.offsetWidth + "px";
timerPlaceholder.style.height = nextButton.offsetHeight + "px";
timerPlaceholder.style.lineHeight = nextButton.offsetHeight + "px";
timerPlaceholder.style.fontSize = "16px";
// Insert placeholder and hide button
nextButton.parentNode.insertBefore(timerPlaceholder, nextButton);
nextButton.style.display = "none";
// Start countdown
let countdownSeconds_sosci = 15; // <- Adjust your countdown duration here
timerPlaceholder.textContent = `Bitte warten... ${countdownSeconds_sosci} Sek.`;
const countdownInterval_sosci = setInterval(() => {
countdownSeconds_sosci--;
if (countdownSeconds_sosci > 0) {
timerPlaceholder.textContent = `Bitte warten... ${countdownSeconds_sosci} Sek.`;
} else {
clearInterval(countdownInterval_sosci);
timerPlaceholder.remove(); // Remove countdown display
nextButton.style.display = ""; // Show button
nextButton.disabled = false; // Ensure it's enabled
nextButton.style.opacity = "1"; // Make it visible/active
nextButton.style.cursor = "pointer";
}
}, 1000);
});
</script>
Danke für die Unterstützung