placeholder兼容
<!------------placeholder兼容------------->
<script type="text/javascript">
$(function () {
if (!placeholderSupport()) { // 判断浏览器是否支持 placeholder
$('[placeholder]').focus(function () {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function () {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.addClass('placeholder');
input.val(input.attr('placeholder'));
}
}).blur();
};
})
function placeholderSupport() {
return 'placeholder' in document.createElement('input');
}
</script>
<!------end------->
placeholder兼容的更多相关文章
- IE9以下 placeholder兼容
//input placeholder兼容!(function ($, doc, win) { $.fn.placeholder = function () { var i = doc.createE ...
- placeholder兼容方法(兼容IE8以上浏览器)
//placeholder兼容方法(兼容IE8以上浏览器) var JPlaceHolder = { //检测 _check: function () { return 'placeholder' i ...
- IE8 placeholder兼容+Password兼容
对于placeholder兼容问题 IE系列的大部分不兼容 使用JQ插件解决这个问题,确实用法很简单 jS下载地址http://www.ijquery.cn/js/jquery.placeholder ...
- placeholder在不同浏览器下的表现及兼容方法 placeholder兼容
1.什么是placeholder? placeholder是html5新增的一个属性,当input或者textarea设置了该属性后,该值的内容将作为灰字提示显示在文本框中,当文本框获得焦点(或 ...
- placeholder 兼容 IE
placeholder 是 html5 的新属性,仅支持 html5 的浏览器才支持 placeholder,目前最新的 FF.Chrome.Safari.Opera 以及 IE10 都支持,IE6- ...
- ☆☆☆☆☆Placeholder兼容各大浏览器的例子☆☆☆☆☆
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- input placeholder兼容ie10以下
代码如下: ,) < ) { $('input[placeholder]').each(function(){ var input = $(this); $(input).val(input.a ...
- input placeholder 兼容问题
placeholder是html5出的新特性,ie9以下是不兼容的, 那么为了兼容ie9 我们需要对他做处理 //jq的处理方式$(function(){ jQuery('[placeholder] ...
- ie9 placeholder兼容
.phcolor{ color:#999;}//css样式 function isPlaceholer(){ var input = document.createElement("inpu ...
随机推荐
- jQuery Mobile高手必备的十大技巧和代码片段
与任何新技术一样,常常难就难在如何开始入手. 有鉴于此,我们整理出了与jQuery Mobile库有关的我认为最便利的一些技巧.方法和代码片段. 由于本文不是旨在全面介绍使用jQuery Mobile ...
- php常用的对字符串进行加密的算法
1. 返回文件扩展名 function getformat($file) { $ext=strrchr($file,"."); $format=strtolower($ext); ...
- 如何"格式化"用过的磁带,让他被新磁带机重复利用
1. 2. 套用翁磊的话: 勾上表示和之前的磁带信息进行协商(但是会失败), 不勾则表示强行擦除.
- php根据IP地址跳转对应的城市,淘宝REST api调用地址直接使用
<?php // 定义一个函数getIP() function getIP(){ global $ip; if (getenv("HTTP_CLIENT_IP")) { $i ...
- switch parser.p4源码
/* Copyright 2013-present Barefoot Networks, Inc. Licensed under the Apache License, Version 2.0 (th ...
- PHP 对象和引用总结
PHP 中使用 简单变量 和 对象 时的区别: ① 很多数据类型都可以写时复制(copy-on-write),例: <?php $a = 'test1'; $b = $a; $b = 'test ...
- PHP 错误与异常 笔记与总结(1)错误(Deprecated,Notice,Warning)
[常见的错误类型] ① 语法错误 [例1]程序语句结尾少了';' <?php $username = "dee" //少了分号; echo $username; 输出: ( ...
- MySQL 命令行导出、导入Select 查询结果
<!-- 环境: Windows 2003 SP2 + MySQL5.5.28 Author: 博客园小dee --> 有的时候需要把在一张表中用 select 语句查询出来的结果保存到另 ...
- image hover
http://www.nxworld.net/tips/css-image-hover-effects.html
- Java中常用的内存区域
在Java中主要存在4块内存空间,这些内存空间的名称及作用如下. 1. 栈内存空间: 保存所有对象名称(更准确的说是保存了引用的堆内存空间的地址). 2. 堆内存空间: 保存每个对象的具体属性内容 ...