How do you change the return key text in Mobile Sa

2019-06-28 06:46发布

问题:

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?

回答1:

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>