I'd like if I could click a link with class "query" and have it's id attribute come after the hash. For example, a link that looks like this:
<a href="#" id="members" class="query">Members</a>
When clicked would change the url from example.com/users
to example.com/users#members
.
Here's my code so far:
$('.query').click(function(event){
event.preventDefault();
window.location.href = $(this).attr('id');
});
Right now clicking the link just moves the url to example.com/members