打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
用JavaScript解决Placeholder的IE8兼容问题
        <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>


http://www.cnblogs.com/jifeng/p/3983368.html
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
jQuery正则表达式的使用方法步骤详解
用jQuery解决input中placeholder值在ie中无法支持的问题
js模仿html5 placeholder
HTML5:placeholder属性详解
Jquery简单的placeholder效果
jquery与正则表达式的应用
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服