Bootstrap-maxlength使用
2015-07-23 20:34
741 查看
这是一个很酷jQuery实现Bootstrap小工具,输入用户同意的字符数.它可以让你显示字符用户插入的最大长度。
1、引入jquery.js及bootstrap-maxlength.js
2、给页面的input或textarea加上maxlength属性
![](http://img.blog.csdn.net/20140619152316031?<br/><br/>watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaXRteWhvbWUxOTkw/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
官网:http://mimo84.github.io/bootstrap-maxlength/
1、引入jquery.js及bootstrap-maxlength.js
2、给页面的input或textarea加上maxlength属性
<input type="text" maxlength="10" id="name">3、配置选项
$(function(){ $('#name').maxlength({ alwaysShow: true }); })代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>bootstrapl.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script> <script type="text/javascript" src="js/bootstrap-maxlength.js"></script> </head> <body> <div style="float: left"> 姓名: </div> <div> <input type="text" style="width:303px" maxlength="10" id="name"> </div> <div style="float: left"> 住址: </div> <div> <textarea name="textarea" id="address" maxlength=20 rows="5" cols="40"></textarea> </div> </body> <script type="text/javascript"> $(function(){ $('#name').maxlength({ alwaysShow: true }); $('#address').maxlength({ alwaysShow: true }); }) </script> </html>效果如图:
官网:http://mimo84.github.io/bootstrap-maxlength/
相关文章推荐
- bootstrap:javascript的通用技术
- bootstrap的alert提示框的关闭后再显示问题
- Bootstrap学习笔记-模态框
- ko.js+bootstrap+HibernateBaseDAO 分页——(1)基础分页
- bootstrap轮播(carousel)图片竖着显示不能轮播的问题解决办法
- 【BootStrap】初步教程
- 关于bootstrap的border-box与原始页面的content-box问题冲突
- bootstrap 一页多个轮播 结合samrty
- Python2.7+Django1.8+Bootstrap3 实现增删改查、分页(一)
- 让Bootstrap 3兼容IE8浏览器
- bootstrap css语法,javascript
- php与bootstrap
- bootstrap实现nav
- 仿oschina分页实现
- bootstrap入门(1) bootstrap下载与安装
- web前端学习(bootstrap3)
- table超过30个字段如何处理呢? bootstrap
- Bootstrap复习笔记
- 关于Breeze.js+Angular.js+KendoUI+BootStrap+TypeScript+EF4.5的使用心得记录之一
- bootstrap fileinput添加上传成功回调事件