zoukankan      html  css  js  c++  java
  • ie下placeholder解决办法

    ! function(window, document, $, undefined) {
        var target, i = 0,
            len, tmpPh;
        if ('placeholder' in document.createElement('input')) return;
        target = $('[placeholder]');
        for (len = target.length; i < len; i++) {
            tmpPh = target[i].getAttribute('placeholder');
            target[i].value = tmpPh;
            target[i].style.color = '#aaaaaa';
            target[i].onmouseover = function() {
                if (this.value != this.getAttribute('placeholder')) return;
                this.value = '';
                this.style.color = '#000000';
            }
            target[i].onblur = function() {
                if (this.value != '') return;
                this.value = this.getAttribute('placeholder');
                this.style.color = '#aaaaaa';
            }
        }
    }(window, document, jQuery); 
    <input type="text" placeholder="请输入你的名字">
    <hr>
    <input type="text" placeholder="aaa">
    <hr>
    <input type="text" placeholder="bbb">
  • 相关阅读:
    Java 源码刨析
    qemu-guest-agent详解
    Java 源码刨析
    NTP服务解析
    virsh常见命令笔记
    Ansible之playbook
    ansible模块详解
    HashMap详解
    Mysql-Incorrect string value
    web开发中前后端传值
  • 原文地址:https://www.cnblogs.com/sharing1986687846/p/10314851.html
Copyright © 2011-2022 走看看