title: Checking and adding on to URL hash using window.location.hash
body: <p>Right now if I have multiple links using:</p>
  
  <pre><code>Options 1:
  &lt;a href="javascript:;" onClick="window.location.hash+='A'"&gt;Option A&lt;/a&gt;
  &lt;a href="javascript:;" onClick="window.location.hash+='B'"&gt;Option B&lt;/a&gt;
  &lt;a href="javascript:;" onClick="window.location.hash+='C'"&gt;Option B&lt;/a&gt;
  
  Options 2:
  &lt;a href="javascript:;" onClick="window.location.hash+='1'"&gt;Option 1&lt;/a&gt;
  &lt;a href="javascript:;" onClick="window.location.hash+='2'"&gt;Option 2&lt;/a&gt;
  &lt;a href="javascript:;" onClick="window.location.hash+='3'"&gt;Option 3&lt;/a&gt;
  
  Options 3:
  &lt;a href="javascript:;" onClick="window.location.hash+='X'"&gt;Option X&lt;/a&gt;
  &lt;a href="javascript:;" onClick="window.location.hash+='Y'"&gt;Option Y&lt;/a&gt;
  &lt;a href="javascript:;" onClick="window.location.hash+='Z'"&gt;Option Z&lt;/a&gt;
  </code></pre>
  
  <p>Whenever clicking any of these, it will keep adding to the URL. Is there a way to check if a current hash already exists (ie. if third character in hash string, then replace with current hash). Any help would be great thanks! I'm trying to accomplish an end result which looks like below even if the user went back and forth between selecting options:</p>
  
  <pre><code>http://mydomain.com/question-page#A3Y 
  </code></pre>