I am trying to setup a form which grabs the hash from the url, then uses that value to determine what radio inputs to check. The latter part is working, but i cannot get the hash retrieval to work.
var url = document.referrer;
var dec= decodeURIComponent(url.replace(/\+/g, '%20'));
var hash = url.substring(url.indexOf('?')+1);
var hash = decodeURI(hash);
In firefox console, i try 'console.log(hash)', and simply get a Reference Error saying that 'hash is not defined'.
The entire script is here if needed - http://pastebin.com/Yq9NbHyz
Because
hash
is not global variable. Usewindow.location.hash
orlocation.hash