How to add a "back to link"

I have a table that a user can access thru a menu drop down on mobile app.

I would like to add a “back to link” below the table that would link you back to a particular page (eg: home).

This would be similar to a link found at the bottom of a details page that Knack adds automatically.

Any and all help is appreciated, thank you… JON

Thank you GPT-4

// Replace ‘view_123’ with the unique identifier of your table view
const tableViewSelector = ‘#view_123’;

// Replace ‘https://your-home-page-url’ with the actual URL of your home page
const homePageUrl = ‘https://your-home-page-url’;

// Add the “Back to Home” action link
function addBackToHomeActionLink() {
// Create a new link (anchor) element
const homeLink = document.createElement(‘a’);
homeLink.textContent = ‘Back to Home’;
homeLink.href = homePageUrl;
homeLink.classList.add(‘kn-link’, ‘kn-link-1’);
homeLink.style.display = ‘block’;
homeLink.style.marginTop = ‘-45px’; // Change this to move link to your preference

// Insert the link after the table view container
const tableView = document.querySelector(tableViewSelector);
if (tableView) {
tableView.parentNode.insertBefore(homeLink, tableView.nextSibling);
}
}

// Add the back link when the view is rendered
$(document).on(‘knack-view-render.view_123’, function(event, view, data) {
addBackToHomeActionLink();
});