title: HTML and JavaScript make search input ready for URL
body: <p>I am making a webpage so I can search google from a custom page.
  But when I click search it does search my input on google but the URL should be different when I input # and % and all these characters.
  So my question is how do I convert something like this : </p>
  
  <pre><code>http://www.google.com/#q=Hello World C#
  </code></pre>
  
  <p>to this :</p>
  
  <pre><code>http://www.google.com/#q=HEllo+world+C%23
  </code></pre>
  
  <p>using JavaScript</p>
  
  <p>EDIT :
  This is the function I tried to use </p>
  
  <pre><code>    $('button#SubmitSearch').click
      (
          function()
          {
              window.location = encodeURIComponent("https://www.google.nl/#q=" + $('input#SearchBar').val());
          }
      );
  </code></pre>
  
  <p>and </p>
  
  <pre><code>    $('button#SubmitSearch').click
      (
          function()
          {
              window.location = "https://www.google.nl/#q=" + $('input#SearchBar').val();
          }
      );
  </code></pre>