placeholder补丁

/*
* 处理placeholder
* 处理对象:所以带有placeholder属性的input
* 处理逻辑:动态改变value值及颜色
*/
(function(jQuery) {

jQuery.fn.placeholder = function() {
        var i = document.createElement(‘input‘),
            placeholdersupport = ‘placeholder‘ in i;
        if (!placeholdersupport) {
            var inputs = jQuery(this);
            inputs.each(function() {
                var input = jQuery(this),
                    text = input.attr(‘placeholder‘),
                    pdl = 0,
                    height = input.outerHeight(),
                    width = input.outerWidth(),
                    placeholder = jQuery(‘<span class="phTips">‘ + text + ‘</span>‘);
                try {
                    pdl = input.css(‘padding-left‘).match(/\d*/i)[0] * 1;
                } catch (e) {
                    pdl = 5;
                }
                placeholder.css({
                    ‘margin‘: 0,
                    ‘margin-left‘: -(width - pdl),
                    ‘height‘: height,
                    ‘line-height‘: height + "px",
                    ‘position‘: ‘absolute‘,
                    ‘color‘: "#cecfc9",
                    ‘bottom‘: ‘auto‘,
                    ‘left‘: ‘auto‘,
                    ‘top‘: ‘auto‘,
                    ‘bottom‘: ‘auto‘,
                    ‘font-size‘: "12px"
                });
                placeholder.click(function() {
                    input.focus();
                });
                if (input.val() !== "") {
                    placeholder.css({
                        display: ‘none‘
                    });
                } else {
                    placeholder.css({
                        display: ‘inline‘
                    });
                }
                placeholder.insertAfter(input);
                input.keyup(function(e) {
                    if (jQuery(this).val() !== "") {
                        placeholder.css({
                            display: ‘none‘
                        });
                    } else {
                        placeholder.css({
                            display: ‘inline‘
                        });
                    }
                });
            });
        }
        return this;
    };

//初始化,也可以单独针对某一个设置
    jQuery(‘input[placeholder]‘).placeholder();

})($);

时间: 2024-08-08 22:00:16

placeholder补丁的相关文章

Oracle 11g RAC自动打GI PSU补丁(11.2.0.4.8)

一.准备工作 1,数据库环境 操作系统版本   : Redhat 6.5 x64   数据库版本     : Oracle 11.2.0.4 x64 RAC    Grid           : 11.2.0.4     Oracle database: 11.2.0.4 本文出自:http://koumm.blog.51cto.com/ 2,准备内容 GI PSU : p21523375_112040_Linux-x86-64.zip    OPatch : p6880880_112000_

WINDOWS 10 企业版LTSB 2015年11月补丁更新情况

WINDOWS 10 企业版LTSB 2015年11月补丁与其他WINDOWS 10版本自动更新KB3105213,按微软对LTSB的规划,LTSB不会轻易增加新功能,所以不会收到其他版本推送的1511更新包,安装这个KB3105213不会改变LTSB内部版本号,LTSB目前内部版本号还是10240, 不会更新到10586版本. LTSB的内部版本按以前的官方说明,一年只会升级一次

微软发布6月漏洞补丁 安全狗建议及时修复

北京时间6月10日凌晨,微软发布了2015年6月安全公告https://technet.microsoft.com/library/security/ms15-jun,本次更新共含8个补丁,其中2个级别为"严重",其余6个级别为"重要",主要修复了 Windows 系统.Office及IE浏览器等组件中的漏洞.服务器安全狗已经第一时间推送了安全更新,请及时修复安全狗提示给您的系统高危漏洞,避免漏洞被利用遭到攻击. 2015年6月微软安全公告简要如下: MS15-05

UITextView添加Placeholder(swift)

UITextView添加Placeholder(swift) by 伍雪颖 添加UILabel并初始化 public let placeholderLabel: UILabel = UILabel() @IBInspectable public var placeholder: String = "" { didSet { placeholderLabel.text = placeholder } } @IBInspectable public var placeholderColor

SCCM2012 R2集成WSUS服务器-5:客户端补丁安装

========================================================== 我们来到客户端上,打开控制面板的configuration manager客户端工具,手动运行一下软件周期的同步,如图. 备注:客户端的configuration manager工具一般是面向技术支持人员的,而软件中心则是面向最终用户的. 已经收到了补丁,如图. 正在进行安装,如图. 安装完成后,如图所示,提示我们这一批安装的更新,需要重启计算机. 当然,也可以看到有些补丁处于已

修改HTML5 input placeholder 颜色及修改失效的解决办法

input::input-placeholder{color: #bdbdbd ;} /* 有些资料显示需要写,有些显示不需要,但是在编辑器webstorm中该属性不被识别 */ ::-webkit-input-placeholder { /* WebKit browsers */ color: #999; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #999; } ::-moz-placeholder { /* Mozi

物理STANDBY打补丁

步骤概要 对于非Oracle Restart Data Guard Physical Standby环境 1.前期检查与准备,检查失效对象. 2.在primary停止日志传输. 3.关闭standby,按照README安装补丁集,打完补丁后,不需要执行(catpatch/catbundle/catcpu等)脚本,启动standby至mount状态,不启用日志应用. 4.关闭primary,按照README安装补丁集,执行(catpatch/catbundle/catcpu等)脚本. 5.启动pr

通达oa破解版下载|通达OA2017破解版|通达OA破解补丁下载

一.百度搜索[通达OA官网]=>[下载]=>[下载2017版]=>[通达OA精灵2017版](Windows.iPhone.Android版本号2017.07.19):安装包下载地址:http://www.tongda2000.com/download/2017.php 二.打开[MYOA2017]=>[安装D盘] 三.单机[所有程序]=>[通达网络办公]=>[通达服务职能配置]=>[web服务协议]=>[web服务名称localhost]=>[Htt

input获得焦点时改变placeholder文本的样式

HTML: <input type="text" placeholder="sample text"/> CSS: input::-webkit-input-placeholder { color: #999; } input:focus::-webkit-input-placeholder { color: red; } /* Firefox < 19 */ input:-moz-placeholder { color: #999; } inpu