zoukankan      html  css  js  c++  java
  • chrome-bug

       1、web前端的问题,为什么chrome浏览器下,input type=text 输入框的提示信息隐藏

    是因为chrome谷歌浏览器input属性他默认的有...可能你需要把input设置一下display:block等

    1 login_html += '<div class="p1">';
    2 login_html += '<span id="_lab_username">论坛帐号/注册邮箱</span>';
    3 login_html += '<input class="pp1" type="text" id="username" style="display:block"/>';
    4 login_html += '<span id="msg_u_w"></span>';
    5 login_html += '</div>' ;

     2、输入框事件监听

     1          
     2     $("#username").on("input",function(evt){                //输入框的id,采用input事件,可以监听任何输入,包括英文,中文,自动补全,粘贴
     3             if(evt.currentTarget.value){
     4                 $(this).prev().css("visibility","hidden");  //span元素采用的是绝对定位的方式
     5             }else{
     6                 $(this).prev().css("visibility","visible");
     7             }
     8             $(this).next().hide();                         //hide()方法的调用实际上是给元素添加 display:none;
     9      });
    10 11 
    12     //for ie username or password input
    13     if(document.all){
    14         $('input').each(function() {
    15             var that=this;
    16             if(this.attachEvent) {
    17                 this.attachEvent('onpropertychange',function(e) {
    18                     if(e.propertyName!='value') return;
    19                     $(that).trigger('input');
    20                 });
    21             }
    22         })
    23     }
  • 相关阅读:
    kvm虚拟机添加网卡
    rsync搭建
    hadoop副本数三个变为一个
    nginx日志ip提取参数介绍
    expect使用
    全球语言排行版查询
    mysql忘记密码(跳过权限修改)
    数据备份从阿里云主机(外网主机)拉取到本地服务器
    nginx+keepalived IP飘移(高可用)
    负载均衡配置
  • 原文地址:https://www.cnblogs.com/yiliweichinasoft/p/3772926.html
Copyright © 2011-2022 走看看