Skip to content

Instantly share code, notes, and snippets.

@dlordi
Created September 25, 2019 20:38
Show Gist options
  • Save dlordi/fe26dbc653c115720973f870ea327d59 to your computer and use it in GitHub Desktop.
Save dlordi/fe26dbc653c115720973f870ea327d59 to your computer and use it in GitHub Desktop.
<form action="search" onsubmit="return !!document.getElementById('textToSearch').value;">
<input name="textToSearch" id="textToSearch" type="text" placeHolder="Search"
onkeypress="if((event.keyCode=='13'||event.charCode=='13'||event.which=='13') && this.value) this.parentNode.submit();" />
<input type="submit" value="Search" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment