How to change the Reserve Now button in the top bar
Learn how to change the text of the Reserve Now button in the navigation / top bar
To change the Reserve Now button, follow these steps:
- Navigate to Custom Coding > JavaScript
- Add the following code, replacing "Contact Us" with your desired text:
document.addEventListener("DOMContentLoaded", function() {
const newText = "Contact Us";
document.querySelectorAll(".nav-desktop-book-button .front").forEach(function(anchor) {
if (anchor.textContent.includes("Reserve Now")) {
anchor.textContent = newText;
}
});
document.querySelectorAll(".mobile-book-now-banner").forEach(function(ele) {
ele.textContent = newText;
});
});To change the destination of the button, use this code instead replacing newURL with your target URL:
document.addEventListener("DOMContentLoaded", function() {
const newText = "Contact Us";
const newURL = "https://example.com/contact-us";
document.querySelectorAll(".nav-desktop-book-button .front").forEach(function(anchor) {
if (anchor.textContent.includes("Reserve Now")) {
anchor.textContent = newText;
anchor.parentElement.href = newURL;
}
});
document.querySelectorAll(".mobile-book-now-banner").forEach(function(ele) {
ele.textContent = newText;
ele.onclick = function() {
window.location = newURL;
};
});
});