簡體   English   中英

輸入類型 email 允許一切

[英]input type email allows everything

我正在嘗試在 HTML5 的表單中添加 email 輸入,但不知何故,它仍然允許我寫任何沒有 @ 和 email 包含的其他內容的東西。

 <input class="form-control" type="email" id="email" name="email" required>

也試過:

<input type="text" pattern="/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/" class="form-control" id="email" name="email" required>

如果我寫錯了,仍然沒有任何反應。

如果您在輸入時沒有嘗試驗證,那么在您提交后它會自動顯示錯誤。

<input accept="image/*;capture=camera" ... allows any file type on mobile< div><div id="text_translate"><p> 如何將圖像瀏覽按鈕限制為僅白色的圖像,允許下拉菜單從相機、庫、移動設備上的文件中進行選擇?</p><p> 這是正在發生的事情:</p><p> 當使用&lt;input type="file" accept="image/*;capture=camera"&gt;我得到了我需要的下拉菜單,但它不限制圖像文件類型 - 它可以是任何東西 (*.*)</p><p> <a href="https://i.stack.imgur.com/5IhHa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5IhHa.png" alt="在此處輸入圖像描述"></a></p><p> 當使用&lt;input type="file" accept="image/*" capture&gt;它只是圖像,但沒有下拉菜單。 相機直接打開。</p><p> 如何獲得下拉 + image/* ?</p><p> 移動演示。 (iPhone 最需要): </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"> &lt;p&gt;Drop-down for camera, library, files but all files allowed:&lt;/p&gt; &lt;input type="file" accept="image/*;capture=camera"&gt; &lt;p&gt;Only images allowed but doesn't have drop-down. Opens camera directly:&lt;/p&gt; &lt;input type="file" accept="image/*" capture&gt;</pre></div></div><p></p><p> <em>目前,我正在使用 JS 來限制非圖像,但想知道是否有 html5 原生方式。</em></p></div>

[英]<input accept="image/*;capture=camera"... allows any file type on mobile

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

相關問題 disableSelection除了輸入以外的所有內容[type = text] 輸入 type=&quot;number&quot; 只允許輸入數字 Input type="number" with pattern="[0-9]*" 允許 firefox 中的字母 Input type=number Safari 仍然允許帶步進器的字母 數字輸入允許您鍵入超過最大值和最小值的數字? 輸入 [type=file] 的接受屬性允許其他擴展名 <input accept="image/*;capture=camera" ... allows any file type on mobile< div><div id="text_translate"><p> 如何將圖像瀏覽按鈕限制為僅白色的圖像,允許下拉菜單從相機、庫、移動設備上的文件中進行選擇?</p><p> 這是正在發生的事情:</p><p> 當使用&lt;input type="file" accept="image/*;capture=camera"&gt;我得到了我需要的下拉菜單,但它不限制圖像文件類型 - 它可以是任何東西 (*.*)</p><p> <a href="https://i.stack.imgur.com/5IhHa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5IhHa.png" alt="在此處輸入圖像描述"></a></p><p> 當使用&lt;input type="file" accept="image/*" capture&gt;它只是圖像,但沒有下拉菜單。 相機直接打開。</p><p> 如何獲得下拉 + image/* ?</p><p> 移動演示。 (iPhone 最需要): </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"> &lt;p&gt;Drop-down for camera, library, files but all files allowed:&lt;/p&gt; &lt;input type="file" accept="image/*;capture=camera"&gt; &lt;p&gt;Only images allowed but doesn't have drop-down. Opens camera directly:&lt;/p&gt; &lt;input type="file" accept="image/*" capture&gt;</pre></div></div><p></p><p> <em>目前,我正在使用 JS 來限制非圖像,但想知道是否有 html5 原生方式。</em></p></div> 在 android 上為輸入類型的電子郵件啟用電子郵件鍵盤 HTML5輸入類型電子郵件 HTML輸入類型為電子郵件和密碼
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM