如何在安卓上移除单词提示?

huangapple go评论60阅读模式
英文:

How to remove word hints on android?

问题

我有这些提示 如何在安卓上移除单词提示?

如何在 Android 浏览器中删除它?

是否可以使用 JavaScript 实现?

英文:

I have those hints 如何在安卓上移除单词提示?

Have can I remove it from browser by android?

Is this possible with JavaScript?

答案1

得分: 1

在HTML中,禁用<input>元素的autocompletespellcheckautocorrectautocapitalize属性。

<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />

如果要通过JavaScript来实现,可以使用setAttribute()方法。

const text = document.getElementById("text");

text.setAttribute("autocomplete", "off");
text.setAttribute("autocorrect", "off");
text.setAttribute("autocapitalize", "off");
text.setAttribute("spellcheck", "false");

请注意,上面的代码示例中使用了一个具有id属性为"text"的<input>元素。

英文:

In HTML, disable the autocomplete, spellcheck, autocorrect, and autocapitalize attributes on the &lt;input&gt; element.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

&lt;input type=&quot;text&quot; autocomplete=&quot;off&quot; autocorrect=&quot;off&quot; autocapitalize=&quot;off&quot; spellcheck=&quot;false&quot; /&gt;

<!-- end snippet -->

Do you want to do it through JavaScript? Use the setAttribute() method.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

const text = document.getElementById(&quot;text&quot;);

text.setAttribute(&quot;autocomplete&quot;, &quot;off&quot;);
text.setAttribute(&quot;autocorrect&quot;, &quot;off&quot;);
text.setAttribute(&quot;autocapitalize&quot;, &quot;off&quot;);
text.setAttribute(&quot;spellcheck&quot;, &quot;false&quot;);

<!-- language: lang-html -->

&lt;input type=&quot;text&quot; id=&quot;text&quot; /&gt;

<!-- end snippet -->

答案2

得分: -1

const MyTextInput = () =&gt; {
  return (
    &lt;View&gt;
      &lt;TextInput
        autoCorrect={false}
      /&gt;
    &lt;/View&gt;
  );
};

将autoCorrect={false}属性设置为false后,TextInput在您的应用程序中应禁用单词建议和更正。

英文:

something like:

const MyTextInput = () =&gt; {
  return (
    &lt;View&gt;
      &lt;TextInput
        autoCorrect={false}
      /&gt;
    &lt;/View&gt;
  );
};

With the autoCorrect={false} property set, the word suggestions and corrections should be disabled for the TextInput in your app.

huangapple
  • 本文由 发表于 2023年7月23日 22:21:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76748731.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定