zoukankan      html  css  js  c++  java
  • 模拟ie9的placeholder

    ie9 的input框没有placeholder属性 啧啧啧~~~

    所以就用span标签来模拟一下

    先判断浏览器类型

    if(navigator.useAgent.indexOf("MSIE 9.0")>0){
       啦啦啦,现在用的是ie9浏览器     
    我想我家东东了~~~ }

    封装函数

    function ifie9(){
        //判断是否是ie9
        if(navigator.userAgent.indexOf("MSIE 9.0")>0){
            //input元素
            $(".ipt").each(function(){
                var self = $(this);
                self.parent().append('<span class="placeholder" data-type = "placeholder">我爱东东</span>')
                if(self.val() != ''){
                    self.parent().find("span.placeholder").hide()
                }else{
                    self.parent().find("span.placeholder").show()
                }
            }).on('foucs',function(){
                $(this).parent().find("span.placeholder").hide()
            }).on('blur',function(){
                var self = $(this);
                if(self.val != ''){
                    self.parent().find("span.placeholder").hide()
                }else{
                    self.parent().find("span.placeholder").show()
                }
            });
            $("span.placeholder").on('clock',function(){
                $(this).hide()
            })
        }
    }
    function ifie9(){
        //判断是否是ie9
        if(navigator.userAgent.indexOf("MSIE 9.0")>0){
            //input元素
            $(".ipt").each(function(){
                var self = $(this);
                self.parent().append('<span class="placeholder" data-type = "placeholder"></span>')
                if(self.val() != ''){
                    self.parent().find("span.placeholder").hide()
                }else{
                    self.parent().find("span.placeholder").show()
                }
            }).on('foucs',function(){
                $(this).parent().find("span.placeholder").hide()
            }).on('blur',function(){
                var self = $(this);
                if(self.val != ''){
                    self.parent().find("span.placeholder").hide()
                }else{
                    self.parent().find("span.placeholder").show()
                }
            });
            $("span.placeholder").on('clock',function(){
                $(this).hide()
            })
        }
    }
  • 相关阅读:
    ESM CORR
    格式化用jad反编译混淆过的代码,能去大部分错误 (zhuanzai)
    Simple Event Correlation installation and configuration
    linux系统时间和硬件时钟问题(date和hwclock)
    float:center???
    [Android]Volley源代码分析(二)Cache
    iTOP-4412 开发板的 GPIO 是怎么操作的?
    Android手掌抑制功能的实现
    第十二周项目3-摩托车继承自行车和电动车
    面对苦难请勇敢
  • 原文地址:https://www.cnblogs.com/wong-do/p/9047980.html
Copyright © 2011-2022 走看看