zoukankan      html  css  js  c++  java
  • placeholder兼容IE8解决方案

    1、原因:placeholder是h5的新属性,IE10以前的浏览器(8、9)不支持此属性。

     

    2、解决方法:jQuery三方插件  jquery-placeholder

    3、快速开始:

    [html] view plain copy
     
     在CODE上查看代码片派生到我的代码片
    1. <!DOCTYPE html>  
    2. <html>  
    3. <head>  
    4.     <title>test</title>  
    5.     <script type="text/javascript" src="jquery-1.9.1.js"></script>  
    6.     <!--[if lte IE 9]>  
    7.      <script src="../../js/jquery/jquery.placeholder.min.js"></script>  
    8.      <script>  
    9.         $(function(){  
    10.             $('input[placeholder]').placeholder();  
    11.         });  
    12.      </script>  
    13.     <![endif]-->  
    14. </head>  
    15. <style type="text/css">  
    16.     input{  
    17.          100px;  
    18.         height: 50px;  
    19.         border: 1px solid red;  
    20.     }  
    21.     .placeholder {  
    22.         color: #ccc;  
    23.     }  
    24. </style>  
    25. <body>  
    26. <input type="text" placeholder="dfdsfdsfad"/>  
    27. </body>  
    28. </html>  

    4、注:此插件和jquery validate混合使用时,密码框password会略过校验,因为新生成的input并没有name属性。解决方法:点击提交按钮时,用js代码给新生成的input添加name属性

  • 相关阅读:
    Mac OS X 下安装Raspbian系统
    Tiny4412 uboot Makefile 分析
    Tiny4412增强版底板串口电路与设置
    为Debian搞定Mercury MW150US无线网卡驱动
    树莓派的启动过程
    xml格式转换为Bean
    j2ee之hibernate工具类
    验证码代码
    j2ee之AJAX的二级联动
    j2ee之原生AJAX
  • 原文地址:https://www.cnblogs.com/huangf714/p/6321872.html
Copyright © 2011-2022 走看看