如何只允许动态文本框中的整数? [英] How to allow only integers in a Dynamic textbox?

查看:57
本文介绍了如何只允许动态文本框中的整数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个动态文本框,例如

 <  输入   类型  ='  text'    Class   ='  TxtBox'    id   ='  txtPhNo'   占位符  =' 输入电话号码'    /  >  





如何只允许此文本框中的整数?

解决方案

参考此代码:仅允许整数jquery


使用Jquery你可以这样做很容易



 <   html  >  
< head >
< script src = http://code.jquery.com/jquery-latest.js > < / script >
< script src = http://digitalbush.com/wp-content/uploads/2013/01/jquery.maskedinput-1.3.1.min_.js > < / script >
< meta charset = utf-8 / >
< title > JS Bin < / title >
< script 类型 =' text / javascript' >


function ( ){
// 定义你的面具


I have a Dynamic textbox like

<input type='text' Class='TxtBox' id='txtPhNo' placeholder='Enter Phone No' />



How to allow only integers in this textbox?

解决方案

Refer this code : Allow only integers jquery


Using Jquery you can do this easily

<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://digitalbush.com/wp-content/uploads/2013/01/jquery.maskedinput-1.3.1.min_.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
  <script type='text/javascript'>


(function(){ //Define your mask


这篇关于如何只允许动态文本框中的整数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆