5

I would like to change the the "return" button text on the Mobile Safari keyboard when my input element is focused. I know you can do this:

<form action="somewebsite.com">
  <input id='SearchTextBox' type="search"/>
  <input id='SearchButton' type="button" value="Search" />  
</form>

But I don't want the form tag because the search is ajaxian (I don't want to reload the page).

Does anyone know if this is possible?

JoshNaro
  • 2,047
  • 2
  • 20
  • 40

2 Answers2

6

Heh, should have thought of this (coworker solved). Just cancel the form submission with JavaScript. For example:

<form action="#" onsubmit="return false;">
  <input id='SearchTextBox' type="search"/>
  <input id='SearchButton' type="button" value="Search" />  
</form>
JoshNaro
  • 2,047
  • 2
  • 20
  • 40
  • Hey, I'm trying to do the same thing, but I don't get how this sets the return key's text. If I want the iOS keyboard to have a "foo" submit key, where would "foo" go in your code? – TahoeWolverine Jun 20 '12 at 21:10
  • @TahoeWolverine – JoshNaro Jun 21 '12 at 14:05
  • 2
    It looks like this works when you have a
    element wrapping your input and when the input has value="Search". If you have another value, the keyboard's return key is "Go".
    – TahoeWolverine Jun 21 '12 at 21:10
3

You can now use enterkeyhint

<input enterkeyhint="search" />

Theres more options like "send", "go", etc

Kolby Watson
  • 483
  • 1
  • 4
  • 6