I have some jQuery/JavaScript code that I want to run only when there is a hash (#) anchor link in a URL. How can you check for this character using JavaScript?
#
This is a simple way to test this for the current page URL:
function checkHash(){ return (location.hash ? true : false); }