title: Show div based on url
body: <p>I've been trying to find a short and easy to understand javascript that show a div based on the URL but all scripts I find doesn't seem to work.</p>
  
  <p>I have this div on my page and the css file hides the div with: display:none;</p>
  
  <pre><code>&lt;div id="idofthedivtohide"&gt;&lt;span&gt;Success!&lt;/span&gt;&lt;/div&gt;
  </code></pre>
  
  <p>When I go to url: contact.php?success I want the div to change to display: block;</p>
  
  <p>Can someone help me with this? Many examples make it work with like 4 lines of code.</p>
  
  <p>I've tried this code but it doesn't seem to work:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  if (window.location.search.search(success)) document.getElementById("idofthedivtohide").style.display = "block"
  &lt;/script&gt;
  </code></pre>