<input class="lineHeight-30" type="text" onkeyup="value=value.replace(/[^\d$]/ig,'')" placeholder="请输入验证码" >

或者

 <input id="numberbox" class="lineHeight-30" type="text" placeholder="请输入验证码" >
function onlyNumber(event){
var keyCode = event.keyCode;
if(keyCode<48 || keyCode>57){
event.keyCode = 0;
}
}
$(function(){
$("#numberbox").keydown(onlyNumber);
});

或者

<input  class="lineHeight-30" type="nuber" placeholder="请输入验证码" >
<input class="lineHeight-30" type="tel" placeholder="请输入验证码" >

移动端input验证只允许有数字 在safari浏览器一直不成功解决的更多相关文章

  1. input输入框只允许输入数字

    /* input输入框只允许输入数字*/ <input type="text" onkeypress="keyPress()" > function ...

  2. input输入框只允许输入数字/ 数字+小数点/ 文字+字母/ 等解决方法

    1.只允许输入数字: <input type="text" onkeyup="this.value=this.value.replace(/[^0-9]/g,'') ...

  3. JS验证只允许输入数字

    1.文本框只能输入数字代码(小数点也不能输入)<input onkeyup="this.value=this.value.replace(/\D/g,'')" onafter ...

  4. input框只允许输入数字 --------20160705

    //jquery方法 var num = $(this).val(); num = parseInt(num); if(!num){ $(this).html(''); } $(this).val(n ...

  5. html input验证只能输入数字,不能输入其他

    html input验证只能输入数字,不能输入其他 此方法为借鉴别人的,在此只做记录. <input type="text" onkeyup="if(!/^\d+$ ...

  6. javascript限制input只允许输入数字

    在做数据提交的表单时,经常要对input输入内容的类型进行限制,譬如javascript限制input只允许输入数字,最好的方法当然是使用javascript,因为它不用与服务器交互,大大减轻了服务器 ...

  7. input输入限制,只允许输入数字和“.”,长度不得超过20

    <input style="margin-top: 10px;width: 100%;text-align:center;" id="removeArea" ...

  8. JavaScript验证字符串只能包含数字或者英文字符的代码实例

    验证字符串只能包含数字或者英文字符的代码实例:本章节分享一段代码实例,它实现了验证字符串内容是否只包含英文字符或者数字.代码实例如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...

  9. JavaScript--文本框中只允许输入数字的操作(其他字符不显示)

    在web网页中,尤其是某些提交表单操作,需要验证文本框输入内容,本文利用文本框键盘事件和事件对象,对文本框只允许输入数字方法进行总结. 1.键盘事件 keydown ---->键盘按下事件    ...

随机推荐

  1. 6.requests编写企查查爬虫

    (为编写完善能拿下来数据) 企查查代码数据如下: #encoding:utf-8 import requests from lxml import etree import random import ...

  2. HTML5 Canvas ( 绘制一片星空 )

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. vs2015 调试IIS

    vs2015 调试IIS vs2015,menu,调试>附加到进程>w3wp 然后用浏览器打开网页,单步调试跟踪. http://blog.csdn.net/hyperhawk/artic ...

  4. springBoot异常处理

    1.status=404 Whitelabel Error Page Whitelabel Error Page This application has no explicit mapping fo ...

  5. 前端-CSS-3-高级选择器

    高级选择器 总结: <!-- 总结: 基础选择器: 1.标签选择器 div 2.类选择器 .div1 3.id选择器 #box 4.通配符选择器 * 高级选择器: 1.群组选择器 中间用, .t ...

  6. autolayout UILabel 设置最大宽度

    label1.preferredMaxLayoutWidth = 100: label1.numberOfLines = 0; //自适应行数

  7. <U+FEFF> character showing up in files. How to remove them?

    You can easily remove them using vim, here are the steps: 1) In your terminal, open the file using v ...

  8. 在Linux下判断系统当前是否开启了超线程

    #lscpu Thread(s) per core: 2Core(s) per socket: 6Socket(s): 2 -------------------------------------- ...

  9. How to Pronounce the Word SOMETHING

    How to Pronounce the Word SOMETHING Share Tweet Share Something tells me you’re going to like this v ...

  10. adb连接过程中常见问题解决方法

    在测试过程中经常会遇到需要使用adb连接服务器的问题,但是有时候经常会遇到连不上的情况,总结两种解决方式 1)error: unknown host service 此问题是由于端口号已经被占用了,可 ...