如何允许 - (Hypen)和。(点)在文本框中使用整数? [英] How to allow -(Hypen) and .(dot) with integers in textbox?

查看:62
本文介绍了如何允许 - (Hypen)和。(点)在文本框中使用整数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

根据我的要求,我需要允许仅包含整数和包含整数的点数。我试过jquery它正在工作。但我也希望在服务器端验证。相同的Jquery代码无效。请给我解决方案。请在jquery中检查我的下面的代码。



Hi all,
As per my requirement i need to allow hypen and dot including integers only. I have tried in jquery it is working. But i want in server side validation also. Same Jquery code is not working.Please give me solution .Please check my below code in jquery.

$('.vision').blur(function () {
           var tobeMatchedwith = /^[+-]?\d{1,3}([.]\d{1,3})?$/;
           var value = $(this).val();
           if (value.match(tobeMatchedwith)) {

           }
           else {
               showStickyWarningToast('Please enter numerics or numerics with . or - only');
           }
           return false;
       });





i需要允许这样的ex:0.01,-0.12等

谢谢



Hari



i need to allow like this ex: 0.01 ,-0.12 etc.
Thanks

Hari

推荐答案

' 。vision')。blur(function(){
var tobeMatchedwith = / ^ [+ - ]?\d { 1 3 }([。] \d {< span class =code-digit> 1 , 3 })?
('.vision').blur(function () { var tobeMatchedwith = /^[+-]?\d{1,3}([.]\d{1,3})?


/;
var value =


this )。val();
if value 。 match(tobeMatchedwith)){

}
else {
showStickyWarningToast(' 请输入数字或数字。或 - 仅');
}
返回 false ;
});
(this).val(); if (value.match(tobeMatchedwith)) { } else { showStickyWarningToast('Please enter numerics or numerics with . or - only'); } return false; });





i需要允许这样的ex:0.01,-0.12等

谢谢



Hari



i need to allow like this ex: 0.01 ,-0.12 etc.
Thanks

Hari


这篇关于如何允许 - (Hypen)和。(点)在文本框中使用整数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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