简体   繁体   English

在iPhone上显示HTML文本区域的“搜索”而不是“返回”

[英]Show 'Search' instead of 'Return' on iPhone for an html textarea

I've read that the solution to display 'Search' instead of 'return' in mobile is to have a form wrapper around an input element and set the type to 'search'. 我已经读过,在移动设备中显示“搜索”而不是“返回”的解决方案是在输入元素周围有一个窗体包装器,并将类型设置为“搜索”。 However, this doesn't work for textareas. 但是,这不适用于textareas。

ie: 即:

<html>
<body>
  <p>
  <form>
    <input name='search' type='search' placeholder="Input type is search" />
  </form>
</body>
</html>

What is the solution to get this to work in a <textarea /> ? <textarea /><textarea />工作的解决方案是什么?

From another thread: Changing keyboard type for html textarea on iPad 从另一个线程: 在iPad上更改html textarea的键盘类型

I wasn't able to find a way to natively do this neither. 我无法找到一种方法来本地执行此操作。 In the past, we've been able to 'trick' the keyboard by setting a hidden input with the correct type, and pushing the resulting text into an alternate container, though we had headaches recreating the the user interactions, text caret, rendering, all just to avoid using the native keyboard. 过去,尽管我们在重新创建用户交互,文本插入符,呈现方式,重新创建内容时遇到麻烦,但通过设置正确类型的隐藏输入并将结果文本推入备用容器中,我们已经能够“欺骗”键盘只是为了避免使用本机键盘。

At best, you're looking at an very impractical solution. 充其量,您正在寻找一个不切实际的解决方案。

Add the action parameter to the form element. action参数添加到表单元素。

<form action=".">
  <input name='search' type='search' placeholder="Input type is search" />
</form>

See this answer - https://stackoverflow.com/a/26287843/4556503 查看此答案-https: //stackoverflow.com/a/26287843/4556503

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM