I have a different scenario, I want to redirect the page on click event to a link/page which contains # sign inside it. when I click on it, page remain on the same location, doesn't redirect, just replace the url in url box. I guess this is because # sign, when I replace with another link without # sign it works fine. I cannot remove this from page link, How do I redirect my page? I want to perform this in jQuery
edit: I don't want to reload my page
edit: not duplicate my link is separated by slashes "/" after and before # sign, not attached with page name
link where I want to redirect
myApp/#/myPage.html
or just
#/myPage.html
HTML
<button id="btn">Click</button>
or
<a id="btn" href="#">Click</a>
I tried these..
<button onClick="window.location='#/myPage.html';">Click</button>
and
$(document).on('click', '#btn', function (e) {
window.location.href = "myApp/#/myPage.html";
//window.location.href = "#/myPage.html"; // this too tried
});
and these
window.location.href = "#/myPage.html";
$(location).attr('href','#/myPage.html');