jQuery EasyUI/TopJUI基本的数字输入框(保留两位小数,带前缀后缀...)
jQuery EasyUI/TopJUI基本的数字输入框(保留两位小数,带前缀后缀...)
numberbox(数值输入框)

HTML
required:必填字段,默认为false;prompt:显示在输入框的提示性文字;min/miax:最小/最大值;
precision:保留的小数位数;prefix:'¥':带前缀;suffix:'$':带后缀;groupSeparator:','字符分割整数组
<fieldset>
<legend>基本数字输入框</legend>
</fieldset> <div class="topjui-row">
<div class="topjui-col-sm6">
<label class="topjui-form-label">年龄</label>
<div class="topjui-input-block">
<input type="text" name="age" data-toggle="topjui-numberbox"> //自然数
</div>
</div>
<div class="topjui-col-sm6">
<label class="topjui-form-label">工龄</label>
<div class="topjui-input-block">
<input type="text" name="gonglin" data-toggle="topjui-numberbox"
data-options="required:true,prompt:'工龄是必填字段'">
</td>
</div>
</div>
</div> <fieldset>
<legend>最大最小值限制</legend>
</fieldset> <div class="topjui-row">
<div class="topjui-col-sm6">
<label class="topjui-form-label">年龄</label>
<div class="topjui-input-block">
<input type="text" name="age" data-toggle="topjui-numberbox"
data-options="min:18,max:120,prompt:'输入范围18至120之间'">
</div>
</div>
<div class="topjui-col-sm6">
<label class="topjui-form-label">工龄</label>
<div class="topjui-input-block">
<input type="text" name="gonglin" data-toggle="topjui-numberbox"
data-options="required:true,min:1,max:60,prompt:'输入范围1到60之间'">
</td>
</div>
</div>
</div> <fieldset>
<legend>带精度的数值输入框</legend>
</fieldset> <div class="topjui-row">
<div class="topjui-col-sm6">
<label class="topjui-form-label">年龄</label>
<div class="topjui-input-block">
<input type="text" name="age" data-toggle="topjui-numberbox"
data-options="precision:2,prompt:'保留2位小数'">
</div>
</div>
<div class="topjui-col-sm6">
<label class="topjui-form-label">工龄</label>
<div class="topjui-input-block">
<input type="text" name="gonglin" data-toggle="topjui-numberbox"
data-options="precision:1,prompt:'保留1位小数'">
</td>
</div>
</div>
</div> <fieldset>
<legend>带标识的数值输入框</legend>
</fieldset> <div class="topjui-row">
<div class="topjui-col-sm6">
<label class="topjui-form-label">工资</label>
<div class="topjui-input-block">
<input type="text" name="age" data-toggle="topjui-numberbox"
data-options="prefix:'¥',prompt:'带前缀的输入'">
</div>
</div>
<div class="topjui-col-sm6">
<label class="topjui-form-label">奖金</label>
<div class="topjui-input-block">
<input type="text" name="gonglin" data-toggle="topjui-numberbox"
data-options="suffix:'$',prompt:'带后缀的输入'">
</div>
</div>
</div> <fieldset>
<legend>带格式化的数值输入框</legend>
</fieldset> <div class="topjui-row">
<div class="topjui-col-sm6">
<label class="topjui-form-label">工资</label>
<div class="topjui-input-block">
<input type="text" name="age" data-toggle="topjui-numberbox"
data-options="groupSeparator:',',prompt:'输入123456789试试'">
</div>
</div>
<div class="topjui-col-sm6">
<label class="topjui-form-label">奖金</label>
<div class="topjui-input-block">
<input type="text" name="gonglin" data-toggle="topjui-numberbox"
data-options="groupSeparator:',',precision:2,prompt:'输入1234567.89试试'">
</div>
</div>
</div>
</div>
js
<input type="text" id="nn">
$('#nn').iNumberbox({
min:0,
precision:2
});
设置输入框的值
$('#nn').iNumberbox('setValue', 206.12);
获取输入框的值
var v = $('#nn').iNumberbox('getValue');
alert(v);
EasyUI中文网:http://www.jeasyui.cn
TopJUI前端框架:http://www.topjui.com
TopJUI交流社区:http://ask.topjui.com
jQuery EasyUI/TopJUI基本的数字输入框(保留两位小数,带前缀后缀...)的更多相关文章
- layui table 前台数字格式保留两位小数,不足补0(mysql 数据库)
layui table 对于后台json数据,有数字的,默认不会原样显示,而是只取数值,即100.00显示为100.如果想原样显示,需转为字符串. 项目采用mysql数据库,字段类型为decimal( ...
- vue input框数字后保留两位小数正则
<el-input type="text" v-model.trim="ruleForm2.marketPrice" maxlength="10 ...
- js-格式化数字保留两位小数-带千分符
很多时候发现有时候js会提示自带函数不能使用,所以自己找了很多资料实现了个 html <input type="text" class="input_text in ...
- td内的所有数字格式化保留两位小数
$("td").each(function(i,el){ var td = parseFloat($(el).text()); if(!isNaN(td)){ $(el).text ...
- (Math.round(num*100)/100).toFixed(2); 将输入的数字变成保留两位小数
<input type="number" @input="onInputPrice" @blur="onPrice" data-id= ...
- js保留两位小数的数字格式化方法
// 格式化数字(保留两位小数) numberFormat (num) { let percent = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/ ...
- Java保留两位小数的几种做法
1. String类型数字始终保留两位小数 , RoundingMode.HALF_UP); return bd.toString(); } /** * 使用DecimalFormat,保留小数点后 ...
- Oracle中保留两位小数
在最近的项目开发中,有个业务需求是界面显示的数字需要保留两位小数,目前我想到的解决方法有两种: (1)在写SQL的时候,直接保留两位小数 (2)在java代码里面将查询出来的数进行格式化处理,保留两位 ...
- JS限制input输入的为数字并且有小数的时候最多保留两位小数
JS限制input用户输入的为数字并且有小数的时候最多保留两位小数,代码如下: html部分: <input type="number" onkeypress="r ...
随机推荐
- sqrt源码
先找出接近m的浮点数,然后通过下面的不等式中的等于条件得到其平方根. #include <iostream> #include <math.h> using namespace ...
- Shell 特殊位置参数的变量
$0 -- 获取当前执行shell脚本的 文件名 $n -- 获取当前执行shell脚本的 第n个参数 $# -- 获取当前执行shell脚本的 带的参数个数 $? -- 获取执行上一个指令的执行状态 ...
- hadoop —— teragen & terasort
这两个类所在目录: hadoop-examples-0.20.2-cdh3u6.jar 中: 代码: TeraGen.java: /** * Licensed to the Apache Softwa ...
- ubuntu tomcat 配置及使用细节
1.改端口号(两个) vi server.xml 一个是http协议端口 <Connector port="8091" protocol="HTTP/1.1&qu ...
- TCP/IP协议数据包文件PCAP分析器
一.设计原理 1.PCAP文件构成 参考http://blog.csdn.net/gulu_gulu_jp/article/details/50494909 PCAP文件由一个PCAP文件头和多个PC ...
- 鸟哥的Linux私房菜-第10/11/12/13章(vim程序编辑器、学习bash、正则表达式与文件格式化处理、学习Shell Scripts)
第10章 vim程序编辑器 可以将vim看做vi的进阶版本,vim可以用颜色或底线等方式来显示出一些特殊的信息. 为何要学习vim?因为: a. 所有的 Unix Like 系统都会内建 vi 文书编 ...
- tensorflow 线性回归 iris
线性拟合
- Python: Neural Networks
这是用Python实现的Neural Networks, 基于Python 2.7.9, numpy, matplotlib. 代码来源于斯坦福大学的课程: http://cs231n.github. ...
- CodeForces - 1000D:Yet Another Problem On a Subsequence (DP+组合数)
The sequence of integers a1,a2,…,aka1,a2,…,ak is called a good array if a1=k−1a1=k−1 and a1>0a1&g ...
- HDU5875Function(单调队列)
The shorter, the simpler. With this problem, you should be convinced of this truth. You are giv ...