解决IE不支持placeholder 2022-05-14 01:37 350阅读 0赞 一.解决方法 /* * jQuery placeholder, fix for IE6,7,8,9 */ var JPlaceHolder = { //检测 _check : function(){ return 'placeholder' in document.createElement('input'); }, //初始化 init : function(){ if(!this._check()){ this.fix(); } }, //修复 fix : function(){ jQuery(':input[placeholder]').each(function(index, element) { var self = $(this), txt = self.attr('placeholder'); self.wrap($('<div></div>').css({position:'relative', zoom:'1', border:'none', background:'none', padding:'none', margin:'none'})); var pos = self.position(), h = self.outerHeight(true), paddingleft = self.css('padding-left'); var holder=""; if($(this).val() == ""){ holder = $('<span></span>').text(txt).css({position:'absolute', left:pos.left, top:pos.top, height:h, lienHeight:h, paddingLeft:paddingleft, color:'#aaa'}).appendTo(self.parent()); }else{ holder = $('<span></span>').text("").css({position:'absolute', left:pos.left, top:pos.top, height:h, lienHeight:h, paddingLeft:paddingleft, color:'#aaa'}).appendTo(self.parent()); } self.focusin(function(e) { holder.hide(); }).focusout(function(e) { if(!self.val()){ holder.show(); } }); holder.click(function(e) { holder.hide(); self.focus(); }); }); } }; //执行 jQuery(function(){ JPlaceHolder.init(); });
相关 JavaWeb 解决jsp不支持placeholder,IE不支持placeholder 一、介绍 placeholder是H5的属性,但是在jsp中,兼容性并不好,很多时候,不起作用,尤其是在IE浏览器中。在开发中,placeholder所体现的功能属性 Bertha 。/ 2022年04月18日 04:29/ 0 赞/ 389 阅读
相关 ie下placeholder解决办法 [ie下placeholder解决办法][ie_placeholder] ! function(window, document, $, undefined) { 快来打我*/ 2022年04月24日 04:40/ 0 赞/ 210 阅读
相关 IE不兼容placeholder属性问题 placeholder属性不支持IE10以下的浏览器并且在IE浏览器下样式并没有谷歌等显示的一样 正常显示 ![70][] IE10以上显示 ![70 1][] IE £神魔★判官ぃ/ 2022年05月09日 14:36/ 0 赞/ 178 阅读
相关 解决IE不支持placeholder 一.解决方法 / jQuery placeholder, fix for IE6,7,8,9 / var JPlaceHolder = 待我称王封你为后i/ 2022年05月14日 01:37/ 0 赞/ 351 阅读
相关 IE不支持 Promise 解决办法 引入 `<script src = "https://cdn.polyfill.io/v2/polyfill.min.js"></script>` 或 `<script t 冷不防/ 2022年05月31日 09:37/ 0 赞/ 313 阅读
相关 jquery input placeholder支持兼容ie7,ie8 <input type="text" placeholder="搜索产品名称"/> <input type="password" placeholder="密码 ゞ 浴缸里的玫瑰/ 2022年07月14日 14:55/ 0 赞/ 143 阅读
相关 jquery input placeholder支持兼容ie7,ie8 <input type="text" placeholder="搜索产品名称"/> <input type="password" placeholder="密码 谁践踏了优雅/ 2022年07月14日 14:55/ 0 赞/ 134 阅读
相关 让IE支持placeholder属性 placeholder 属性提供可描述输入字段预期值的提示信息 该提示会在输入字段为空时显示,并会在字段获得焦点时消失。 但placeholder不支持IE10以下版本 Love The Way You Lie/ 2022年08月19日 02:15/ 0 赞/ 182 阅读
相关 解决 IE 不支持 getElementsByClassName() 的方法 //create method getElementsByClassName for document if(!document.getElements 悠悠/ 2022年11月28日 13:17/ 0 赞/ 93 阅读
相关 解决IE8不支持console 转自:https://www.cnblogs.com/wz122889488/p/6272751.html 解决IE8不支持console,代码中包含console时会报错 喜欢ヅ旅行/ 2022年12月04日 02:27/ 0 赞/ 148 阅读
还没有评论,来说两句吧...