Hi everyone, I have a code snippet that is designed to read the value after the hash in the URL and display a specific div based on that value. It works as expected, except for when the hash is changed while already on the site or when navigating back with the back button. In these cases, the div does not update accordingly. The site is set up to not reload on div changes, so I suspect that the JavaScript function is only called once on page load, causing the issue. I need a solution that will trigger the function whenever the URL changes. Here is the current code:
function hash() {
var hash = window.location.hash.replace('#','');
InsertContent(hash);
}