Created
June 18, 2014 06:22
-
-
Save waitingallday/76b72273601cb2836d02 to your computer and use it in GitHub Desktop.
Defeat the hash #
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
form = document.querySelector("form"); | |
form.addEventListener("submit", function(event) { | |
e.preventDefault(); | |
window.location = this.action + "#q=" + this.elements[1].value | |
} | |
// or you could wrap it in a domready container ie. | |
var domReady = function() { | |
n = document.querySelector("form"), n.addEventListener("submit", function(e) { | |
return e.preventDefault(), window.location = this.action + "#gsc.q=" + this.elements[1].value | |
}); | |
}; | |
window.attachEvent ? window.attachEvent("onload", domReady) : document.addEventListener("DOMContentLoaded", domReady, !1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment