perhaps too simple what I ask, or maybe not. Anyway, I need to call a specific anchor of the page when I click on the link, it enters a specific URL with a specific anchor list down to that anchor.
I am doing this with jquery as follows:
$(document).ready(function() {
var anchor = window.location.hash.substring(1);
if(anchor!="") {
var newAnchor= "'#anchor-" +anchor+"'";
$(newAnchor).trigger("click");
}
});
I think this is impossible, of course, I never saw him, I get the following error:
Uncaught Error: Syntax error, unrecognized expression: '#anchor-2015'
Is it possible to dynamically call a selector? Was there another way?
Thanks.
source
share