ITeye博客

html5

共 1 篇文章

placeholder的浏览器兼容

【前言】 自从html5引入placeholder后,问题就来了, 不支持html5的浏览器也先有这样的效果, 各种兼容,之前考虑,今天测试人员逮住不放, 想了个解决办法,看样子还行,记录一下。 【原理】 不使用placeholder,而是模拟placeholder的效果, 大概就是用focus和focusout效果。 【代码】 <script> $(function(){ $('input.holder').each(function(){ var $this = $(this); var holder = $this.data('holder'); if(holder){ $this.c…

2015-05-27 17:20 · html5 · placeholder