I can’t change the text in one calendar message

[ad_1]

I need to change one message generated by the calendar to another, I mean the message “There are no upcoming events.”. I tried with the below JS, but it didn’t work. Please help – how can I change the content of this message?

document.addEventListener("DOMContentLoaded", function () {
const updateEventMessage = () => {
const noEventsMessage = document.querySelector(
".tribe-events-c-messages__message-list-item[data-key='0']"
);

if (noEventsMessage && noEventsMessage.textContent.trim() === "There are no upcoming events.") {
noEventsMessage.textContent = "My NEW text.";
}
};

const observer = new MutationObserver(function (mutationsList) {
mutationsList.forEach(function (mutation) {
if (mutation.type === "childList") {
updateEventMessage();
}
});
});

const targetNode = document.querySelector(".tribe-events-c-messages__message-list");
if (targetNode) {
observer.observe(targetNode, {
childList: true,
subtree: true
});
}

updateEventMessage();
});

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer