IE8 placeholder兼容+Password兼容
对于placeholder兼容问题 IE系列的大部分不兼容
使用JQ插件解决这个问题,确实用法很简单
jS下载地址http://www.ijquery.cn/js/jquery.placeholder.min.js
<script type="text/javascript" src="http://www.ijquery.cn/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://www.ijquery.cn/js/jquery.placeholder.min.js"></script>
<script type="text/javascript">
$(function(){ $('input, textarea').placeholder(); });
</script>
后续,placeholder引发的一系列问题
谨慎:早期的placeholder.min.js可能对Password输入框不支持,
很多人都困惑对Password的解决办法,下面分享一些利用placeholder.min.js+validate.js的一套验证demo
<script type="text/javascript" src="~/Scripts/jquery-1.7.1.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/Jquery.validate.expand.js"></script>
<script src="~/Scripts/jquery.placeholder.min.js"></script>
$("#Form").validate({
ignore: "",
rules: {
Name: { required: true, rangelength: [4, 20],chrnum: true,CheckUserName:true },
Password: { required: true, rangelength: [4,20] },
Newpassword: { equalTo: '#Password',rangelength: [4,20] },
Mobile: { required: true,rangelength: [5, 15],digits:true,CheckPhone:true },
check: { required: true}
},
messages: {
Name: { required: "账号名称不能为空", rangelength: "请输入4-20个字母、数字组合",chrnum:"请输入4-20个字母、数字组合",CheckUserName:"该账号已被注册" },
Password: { required: "密码不能为空", rangelength: "请输入4-20个字" },
Newpassword: { equalTo: "两次密码输入不一致",rangelength: "请输入4-20个字" },
Mobile: { required: "请输入联系电话",rangelength:"请输入5-15个字",digits:"请输入有效数字",CheckPhone:"该联系号码已被使用" },
check: {required:"请选择复选框"}
},
//对radio或checkbox的扩展
errorPlacement: function (error, element) { //指定错误信息位置
if (element.is(':checkbox')) { //如果是radio或checkbox
var eid = element.attr('name'); //获取元素的name属性
error.appendTo(element.parent()); //将错误信息添加当前元素的父结点后面
} else {
error.insertAfter(element);
}
},
submitHandler: function (form) {
//ajax请求后台数据
}
})
IE8 placeholder兼容+Password兼容的更多相关文章
- 记录:asp.net mvc 中 使用 jquery 实现html5 实现placeholder 密码框 提示兼容password IE6
@{ViewBag.Title = "完美结合";} <script>var G_start_time = new Date;</script> <! ...
- jquery html5 实现placeholder 兼容password ie6
<style type="text/css"> /* 设置提示文字颜色 */ ::-webkit-input-placeholder { color: #838383; ...
- 强制将IE8设置为IE7兼容模式来解析网页
强制将IE8设置为IE7兼容模式来解析网页 英文原文:http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx 文件兼容性用于定义让IE ...
- UI设计文本框解决Placeholder的在IE10 以下 IE 9 IE8 IE 7 的兼容问题
创建JS文件 placeholderfriend.js (function($) { /** * 牛叉的解决方案 */ var placeholderfriend = { focus: functio ...
- ie8中遇到的兼容问题以及解决方案
一.CSS3 1.可以通过在css中引入pie.htc,处理兼容问题(可处理的属性) -webkit-box-shadow: 0 1px 5px #ff2826; -webkit-border-rad ...
- input输入框的border-radius属性在IE8下的完美兼容
在工作中我们发现搜索框大部分都是有圆角的,为此作为经验不足的前端人员很容易就想到,给input标签添加border-radius属性不就解决了嘛.不错方法确实是这样,但是不要忘了border-radi ...
- ie8中支持 password 的 placeholder
之前写过一篇 ie8中使用placeholder 的博客,但是,该文中的 placeholder 在 type="password" 时会出现问题,不能显示文字而是密码类型的点,所 ...
- IE8一枝独秀的JS兼容BUG
// 例如淡入淡出的封装类文件 function ImagesEff(div,time){ this.arr=[];//装载所有div this.time=time; this.recordOld=n ...
- placeholder各种浏览器兼容问题
只要在页面上引入placeholder.min文件,再以$('input,textarea').placeholder(); 就可以兼容ie等各种浏览器. placeholder.min.js文件链接 ...
随机推荐
- 【转】常见 jar包详解
转载自:http://www.cnblogs.com/xusir/archive/2013/05/19/3086878.html jar包 用途 axis.jar SOAP引擎包 commons- ...
- BZOJ 1049 数字序列
Description 现在我们有一个长度为n的整数序列A.但是它太不好看了,于是我们希望把它变成一个单调严格上升的序列.但是不希望改变过多的数,也不希望改变的幅度太大. Input 第一行包含一个数 ...
- Nah Lock: 一个无锁的内存分配器
概述 我实现了两个完全无锁的内存分配器:_nalloc 和 nalloc. 我用benchmark工具对它们进行了一组综合性测试,并比较了它们的指标值. 与libc(glibc malloc)相比, ...
- zip file 压缩文件
有时候我们希望 upload 文件后自动压缩, 可以节省空间. 可以使用微软提供的压缩代码 Install-Package System.IO.Compression.ZipFile -Version ...
- C#程序设计基础——字符串
C#字符串使用string关键字声明,且由一个或多个字符构成的一组字符. 串联字符串 串联字符串是将一个字符串追加到另一个字符串末尾的过程.使用“+”或“+=”运算符串链字符符文本或字符串常量.串联字 ...
- 【HDOJ】4704 Sum
数学题.f(n) = 2^(n-1) mod (1e9+7). #include <cstdio> #define MAXN 100005 char buf[MAXN]; __int64 ...
- POJ-3468-A Simple Problem with Integers(区间更新,求和)-splay或线段树
区间更新求和 主要用来练习splay树区间更新问题 //splay树的题解 // File Name: 3468-splay.cpp // Author: Zlbing // Created Time ...
- Rotate List —— LeetCode
Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1 ...
- HDOJ(HDU) 2401 Baskets of Gold Coins(数列、)
Problem Description You are given N baskets of gold coins. The baskets are numbered from 1 to N. In ...
- Selenium webdriver firefox 路径设置问题
问题: Cannot find firefox binary in PATH. Make sure firefox is installed. 原因:selenium找不到Firefox浏览器. 方法 ...