Changing an URL hash from a form submit

html, javascript, jquery

Solution

Well not with jQuery but that should work:

<form action="/search" id="search-form"
      onsubmit="location.href=this.action+'#s='+this.s.value; return false;">
    <input type="text" id="search-input" name="s" x-webkit-speech>
</form>

See also this fiddler: http://jsfiddle.net/SujwN/

Problem

On my index.html I have the following form: ``` <form action="/search" id="search-form"> <input type="text" id="search-input" name="s" x-webkit-speech> </form> ``` Which correctly redirects to `/search?s=searchvalue` but how could I change that to `/search#s=searchvalue` using javascript?

Original source