菜鸟教程小白 发表于 2022-12-11 16:43:15

android - 电话 : numeric keyboard for text input


                                            <p><p>有没有办法强制数字键盘出现在手机上以获取 <code><input type="text"></code>?我才意识到<a href="http://www.w3.org/TR/html-markup/input.number.html" rel="noreferrer noopener nofollow"><code>&lt;input type=&#34;number&#34;&gt;</code></a> HTML5 中用于“ float ”,因此不适合用于信用卡号、邮政编码等。</p>

<p>我想模拟 <code><input type="number"></code> 的数字键盘功能,用于接受 float 以外的数值的输入。是否有其他合适的 <code>input</code> 类型可以做到这一点?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您可以执行 <code><input type="text"pattern="\d*"></code>。这将导致出现数字键盘。</p>

<p>更多详情请看这里:<a href="https://developer.apple.com/library/archive/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html" rel="noreferrer noopener nofollow">Text, Web, and Editing Programming Guide for iOS</a> </p>

<p></p><div class="snippet"data-lang="js"data-hide="false"data-console="true"data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form&gt;
&lt;input type=&#34;text&#34; pattern=&#34;\d*&#34;&gt;
&lt;button type=&#34;submit&#34;&gt;Submit&lt;/button&gt;
&lt;/form&gt;</code></pre>

                                                <p style="font-size: 20px;">关于android - 电话 : numeric keyboard for text input,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/37798748/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/37798748/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: android - 电话 : numeric keyboard for text input