<script type="text/javascript">  

  if( !('placeholder' in document.createElement('input')) ){  
   
    $('input[placeholder],textarea[placeholder]').each(function(){   
      var that = $(this),   
      text= that.attr('placeholder');   
      if(that.val()===""){   
        that.val(text).addClass('placeholder');   
      }   
      that.focus(function(){   
        if(that.val()===text){   
          that.val("").removeClass('placeholder');   
        }   
      })   
      .blur(function(){   
        if(that.val()===""){   
          that.val(text).addClass('placeholder');   
        }   
      })   
      .closest('form').submit(function(){   
        if(that.val() === text){   
          that.val('');   
        }   
      });   
    });   
  }  
</script> 

placeholder兼容ie8的更多相关文章

  1. placeholder兼容IE8解决方案

    1.原因:placeholder是h5的新属性,IE10以前的浏览器(8.9)不支持此属性.   2.解决方法:jQuery三方插件  jquery-placeholder 3.快速开始: <! ...

  2. 兼容IE8以下浏览器input表单属性placeholder不能智能提示功能

    当前很多表单提示使用了表单属性placeholder,可这属性不兼容IE8以下的浏览器,我自己写了一个兼容处理js // 兼容IE8以下浏览器input不能智能提示功能 if(navigator.ap ...

  3. placeholder兼容方法(兼容IE8以上浏览器)

    //placeholder兼容方法(兼容IE8以上浏览器) var JPlaceHolder = { //检测 _check: function () { return 'placeholder' i ...

  4. IE8 placeholder兼容+Password兼容

    对于placeholder兼容问题 IE系列的大部分不兼容 使用JQ插件解决这个问题,确实用法很简单 jS下载地址http://www.ijquery.cn/js/jquery.placeholder ...

  5. bootstrap3 兼容IE8浏览器

    近期在使用bootstrap这个优秀的前端框架,这个框架非常强大,框架里面有下拉菜单.按钮组.按钮下拉菜单.导航.导航条.面包屑.分页.排版.缩略图.警告对话框.进度条.媒体对象等,bootstrap ...

  6. bootstrap兼容IE8的一些注意

    准备 bootstrap 3.3.5 jQuery 1.12.0 注意 支持html5 需要引入html5.js 支持placeholder 需要引入placeholder.js ie8 不支持 fo ...

  7. 兼容ie8总结

    最近做了个兼容ie8的项目,把遇到的一些坑总结一下,欢迎大神指正,共勉. 一. js相关 1.  关于库的引用 jquery只能引用1.x的版本,swiper只能引用2.x的版本. 2. 动态生成的d ...

  8. bootstrap3兼容ie8浏览器

    bootstrap3 兼容IE8浏览器 2016-01-22 14:01 442人阅读 评论(0) 收藏 举报  分类: html5(18)    目录(?)[+]   近期在使用bootstrap这 ...

  9. 如何使用videojs兼容IE8浏览器

    需要在服务器下运行 首先我们需要下载videojs包 https://github.com/videojs/video.js/releases 这里简单写了一个小栗子 <!DOCTYPE htm ...

随机推荐

  1. 文件代码对比软件 Beyond Compare

    Beyond Compare https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=Beyond%20Co ...

  2. java final方法的作用

    1. 不想让别人修改方法实现. 2. 在方法调用时使用内嵌调用. 3. 有效的“关闭”动态绑定,这样编译器就可以为final方法调用生成更有效的代码. Java编程思想: “然而,大多数情况下,这样做 ...

  3. html 锚点的使用

    html 锚点 到底是干吗的?通俗简单地说,比如一篇很长的文章,你想按分段精确来看,那就可以用到锚点了. 代码:<a href="#001">跳到001</a&g ...

  4. A trip through the Graphics Pipeline 2011_07_Z/Stencil processing, 3 different ways

    In this installment, I’ll be talking about the (early) Z pipeline and how it interacts with rasteriz ...

  5. php执行root命令

    一.确定php的sysem等函数可用 二.编写c程序,如ipt.c #include <stdio.h>#include <stdlib.h>#include <sys/ ...

  6. AjaxPost、冒泡示例

    //Ajax提交表单 $("#AssetsForm").submit(function () { $.ajax({ type: "post", url: &qu ...

  7. go gomail

    package main //cmd: go get gopkg.in/gomail.v1 import ( "gopkg.in/gomail.v1" ) func main() ...

  8. Android如何连接MySQL数据库

    Android开发中,大多数连接到远程MySQL数据库的方法是加入特定的Service到代码中.由于MySQL通常是和PHP一起使用的,最简单以及最常见的方法是写PHP脚本管理数据连接,以及从Andr ...

  9. MyEclipse 8.5整合Git,并在Github上发布项目【转】

    最近Git火得如日中天,而且速度体验和团队模式都很不错.手头正好有个学生实训项目,时间紧任务重,而且学校内网管理太紧,所以就想借助于Internet的分布式开发,因此想到了Github. 经过一天的调 ...

  10. mysql重点--索引

    1.关于索引 # 什么是索引 索引是表的目录,在查找内容之前可以先在目录中查找索引位置,以此快速定位查询数据. #索引的作用 加速查询和约束. # 为什么索引查询会变快 没创建一个索引会相应的创建一个 ...