// Wait for the page to load
document.addEventListener("DOMContentLoaded", function() {
// Get the quiz retake button element
var retakeButton = document.querySelector('.take.shawn-s-school-2f08-tenant.course-id-2217175 .quiz-retake-button');
// Check if the retake button exists
if (retakeButton) {
// Get the number of failed attempts from Thinkific's data attribute
var failedAttempts = parseInt(retakeButton.getAttribute("data-failed-attempts"));
// Check if the user has failed the quiz twice
if (failedAttempts >= 2) {
// Hide the retake button
retakeButton.style.display = "none";
// Create a message element
var messageElement = document.createElement("p");
messageElement.textContent = "You did not pass this course";
// Insert the message element after the retake button's parent
retakeButton.parentNode.insertBefore(messageElement, retakeButton.nextSibling);
}
}
});