【发布时间】:2013-12-01 11:22:26
【问题描述】:
我有以下html字段,我需要检查输入值是float还是int,
<p class="check_int_float" name="float_int" type="text"></p>
$(document).ready(function(){
$('.check_int_float').focusout(function(){
var value = this.value
if (value is float or value is int)
{
// do something
}
else
{
alert('Value must be float or int');
}
});
});
那么如何在jquery中检查一个值是float还是int。
我需要查找/检查这两种情况,无论是浮点数还是整数,因为稍后如果值是float,我会将它用于某些目的,同样用于int。
【问题讨论】: