問題:html中如何限制輸入框允許輸入的字符長度
解決辦法:給input標簽添加屬性值:maxlength="允許輸入最長的字符長度"
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8" /> 5 <title>test</title> 6 </head> 7 <body> 8 最大只能輸入12個字符的輸入框:<input type="text" maxlength="12"> 9 </body> 10 </html>
問題:html中如何限制輸入框允許輸入的字符長度
解決辦法:給input標簽添加屬性值:maxlength="允許輸入最長的字符長度"
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8" /> 5 <title>test</title> 6 </head> 7 <body> 8 最大只能輸入12個字符的輸入框:<input type="text" maxlength="12"> 9 </body> 10 </html>
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。