<input type="text"  maxlength="5" />   //可以

<input type="number"  maxlength="5" />  //没有效果

<input type="number" oninput="if(value.length>5) value=value.slice(0,5)" /> //js控制,可以

<input type="tel"  maxlength="5" />  //tel类型,可以

此外,tel类型的input在ios上会调出全数字键盘,而number类型的input则会调出带有标点符号的键盘。

input最大长度限制问题的更多相关文章

  1. 如何限制html标签input的长度

    如何限制html标签input的长度 示例: <form action="/example/html/form_action.asp" method="get&qu ...

  2. vue input输入框长度限制

    今天在开发登录页时,需要设置登录输入框的长度,输入类型为number <input type="number" maxlength="11" placeh ...

  3. js判断input输入框长度(支持中英文输入)

    function CheckTxtLength(txt) { var num = txt.replace(/[^\x00-\xff]/g, 'xx').length; if (num <=11) ...

  4. input 设置长度限制 去除默认样式

    1. <input id="mobile" maxlength="11> 2. input type 为 number 时,maxlength 失效 < ...

  5. 文本框(代替input)输入长度限制、提示

    <div class="inform_content_text"> <textarea name="name" placeholder=&qu ...

  6. Angularjs中input的指令和属性

    建议添加 novalidate属性(可无值)到form标签上,这样可以保证在表单不合法的情况下阻止浏览器继续提交数据. 可以给表单元素 input 添加 required 属性(可无值),让该表单成为 ...

  7. input range样式优化

    首先HTML代码: <input id="snrPollInterval" type="range" min="1" max=&quo ...

  8. [转]C#网络编程(订立协议和发送文件) - Part.4

    本文转自:http://www.tracefact.net/CSharp-Programming/Network-Programming-Part4.aspx 源码下载:http://www.trac ...

  9. [转]C#网络编程(异步传输字符串) - Part.3

    本文转自:http://www.tracefact.net/CSharp-Programming/Network-Programming-Part3.aspx 这篇文章我们将前进一大步,使用异步的方式 ...

随机推荐

  1. MySQL基础教程——创建数据库并插入数据

    本节将介绍 MySQL 新建数据库,新建表,插入数据以及基本数据类型的相关知识.本节实验将创建一个名为 mysql_shiyan 的数据库,其中有两张表 employee和 department. 1 ...

  2. Python基础篇 -- 集合

    set集合 set 中的元素是不重复的,无序的 里面的元素必须是可hash的,(int str tuple bool) set 就是dict 类型的数据,但是不保存value 只保存 key set集 ...

  3. alibaba druid监控页面的使用配置

    一.Maven中添加Durid连接池依赖 <!-- druid连接池 --> <dependency> <groupId>com.alibaba</group ...

  4. 在ASP.NET项目中的web.config文件里配置数据库连接并在程序代码中获取连接字符串

      1.在<connectionStrings> 标签里添加连接 <connectionStrings> <add name="ConnectionName&q ...

  5. ll1文法

    <program>-><external_declaration> | <program> <external_declaration> < ...

  6. Windows平台下MySQL常用操作与命令

    Windows平台下MySQL常用操作与命令 Windows平台下MySQL常用操作与命令,学习mysql的朋友可以参考下. 1.导出整个数据库 mysqldump -u 用户名 -p --defau ...

  7. 几种排序算法的比较转自http://blog.csdn.net/keenweiwei/article/details/3697452

    1冒泡排序: 已知一组无需数据a[1],a[2],a[3],a[4],a[5][a[n],将其按升序排列,首先找出这组数据中最大值,将a[1]与a[2]比较,若a[1]大,则交换两者的值,否则不变,在 ...

  8. Matlab-plot绘图

    plot函数 形式 字符控制 常用的图形标记函数 subplot命令拆分窗口 其他常见命令 三维绘图plot3 mesh和contour命令 plot函数 形式 plot(a,'-s')如果a是实数矩 ...

  9. java版RSA工具类

    /** * RSA算法加密/解密工具类 */ public class RSAUtils { private static final Logger LOGGER = LoggerFactory.ge ...

  10. destoon 自定义session丢失

    destoon 在使用session之前 应该实例化 $s​ession = new dsession(); destoon通过配置文件加载了不同session存储方式.如果你使用session的页面 ...