实现IE浏览器兼容placeholder效果

IE浏览器支持placeholder 现在流行html5了都,所有的浏览器都支持placeholder,唯独IE不支持,那么这插件将完美解决IE浏览器不兼容input标签的placeholder属性. 立即下载

placeholder是HTML5的属性之一,在不同的浏览器( 支持HTML5的现代浏览器 )中会有略微不同的显示效果,
在Chrome( v31.0.1650.63 m)、Firefox( v21.0 )、360安全( v6.3 极速模式 )中,输入栏获得焦点后,提示文字并不消失,但是IE6-IE9 是不支持placeholder属性的。

思路是,首先判断浏览器是否支持placeholder属性,如果不支持的话,就遍历所有input输入框,获取placeholder属性的值填充进输入框作为提示信息,同时字体设置成灰色。

        var browser=navigator.appName;
        var b_version=navigator.appVersion;
        var version=b_version.split(";");
        var trim_Version=version[1].replace(/[ ]/g,"");
        if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE9.0"){
            function holder(Iip){
                var txtHolder=Iip.attr("placeholder");
                Iip.val(txtHolder).addClass("hint");
                Iip.attr("type","text");
                Iip.focus(function(){
                    if($(this).val() == txtHolder){
                        $(this).val("").removeClass("hint");
                    }
                    if(Iip.attr("name")=="password"){
                        Iip.attr("type","password");
                    }
                }).blur(function(){
                    if($(this).val().trim() === ""){
                        $(this).val(txtHolder).addClass("hint");
                        Iip.attr("type","text");
                    }
                });
            }
        }
IE下实现placeholder效果的jquery插件 IE下实现placeholder效果的jquery插件,同时支持文本和密码输入框,内附demo 立即下载

相关推荐

placeholder:IE5.5~9 的 polyfill 不支持占位符功能

占位符 v1.0 IE5.5~9 的 polyfill 不支持占位符功能v1.0支持input[type="text"]的占位符特性。 全局设置placeholder.attr :指定占位符特性名称,默认为数据占位符placeholder.color :指定占位符的文字前景色,默认为#888 用法: <html> <head></head> <body> <form> <input type="text" placeholder="type your name pls."/> <input type="text" placeholder="type your number pls."/> <textarea placeholder="type detail pls."></textarea> </form> <!--[if lte IE 9]>

在ie中实现placeholder属性(其实主要针对ie8,9)

在ie中实现placeholder属性,一般有两种方法: 一种是在该input下方创建一个div,上面显示placeholder的值,利用绝对位置和相对位置,覆盖在input上方,使其看上去如同有了placeholder属性一样,好处是和input框是分开的,提交校验时不需要特殊处理。坏处是样式可能多变,没法做到统一。 还有一种是利用input中value属性,使value = placehol...

weixin_44805156的博客 746

针对IE浏览器9导致input输入款placeholder不显示问题

针对IE浏览器9导致input输入款placeholder="请输入您想输入的内容"不显示问题

IE7 浏览器兼容 input placeholder 属性完美解决

第一种方式,使用插件(jquery.placeholder) <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Untitled Document</title> <script src="./jquery-1.10.2.min.js"></script> <script src="./jqu

小学程序员的博客 474

matlab锅炉 pid仿真,基于Matlab锅炉仿真.doc

基于Matlab锅炉仿真内蒙古科技大学MATLAB课程设计任务书2012题 目:锅炉汽包水位控制系统学生姓名:林三彪学 号:0967112127专 业:测控技术与仪器班 级:2009-1指导教师:梁 丽摘 要锅炉是化工、炼油、发电、造纸和制糖等工业生产过程中必不可少的重要动力设备。锅炉往往成了不少工厂不可缺少的一部分,因而,对锅炉设备中的自动控制系统进行分析研究是必要的...

weixin_29133981的博客 1096

AD9361 RSSI配置实战:从寄存器到精准功率测量的避坑指南

本文详细解析了AD9361芯片的RSSI配置实战,从寄存器设置到精准功率测量的全流程避坑指南。通过优化模式选择、测量持续时间及高级参数配置,实现高精度信号强度测量,并分享实际项目中的校准流程与性能优化技巧,帮助工程师提升射频接收链路的测量精度。

weixin_38166557的博客 443

ie浏览器 无法显示placeholder内容解决办法

ie9 placeholder不兼容问题解决

~ 1289

ESP32设备驱动-VCNL4040趋近传感器

VCNL4040 将趋近传感器 (PS)、环境光传感器 (ALS) 和高功率 IRED 集成到一个小型封装中。它通过CMOS工艺将光电二极管、放大器和模数转换电路集成到一个芯片中。

视觉与物联智能 939

ie浏览器下placeholder属性失效的解决办法

1,在页面设计中,表单的设计需要提示性的词语来引导用户使用,最常见的的就是使用标签placeholder属性,只可惜这个HTML 5属性在低版本的IE下会失效,那该怎么办呢? 2,placeholder 属性提供可描述输入字段预期值的提示信息。该提示会在输入字段为空时显示,并会在字段获得焦点时消失。 3,只需要使用以下js代码,就可以解决placeholder属性在IE中失效了。 &amp;lt;scri...

笨小蛋的博客 3568

Modbus RTU/TCP协议栈手写实现:主从站设计、功能码、CRC、异常响应

本文从协议栈架构、帧结构、功能码、CRC校验、异常响应、主从站设计等多个维度,完整阐述了Modbus RTU/TCP协议栈的手写实现方案。帧间隔机制是RTU的核心,T3.5超时检测决定了帧边界识别CRC16查表法以512字节ROM换取8倍性能提升,适合嵌入式功能码路由表实现可扩展的代码架构,便于新增功能异常响应机制保障协议健壮性,每个错误都有明确反馈Modbus TCP在RTU基础上增加MBAP头,实现以太网扩展多核RTOS环境下的并发访问与线程安全RS-485总线的电气隔离与浪涌保护。

从事移动开发八年,csdn博客专家,阿里云特邀专家,华为云云享专家,高级网络信息安全工程师,大数据工程师(高级),python技术开发(高级),HarmonyOS 应用开发者高级认证,现在某学校任教。 1万+

海康威视嵌入式最全面试题及参考答案(3万字长文)

主营业务:提供包括前端摄像头、后端存储设备、显示控制设备等在内的全方位视频监控解决方案。市场地位:在全球范围内享有较高的市场份额,在安防领域具有较强的竞争力。技术创新:持续投入研发,拥有多项核心技术和专利,特别是在视频处理算法、人工智能等方面取得了显著成果。社会责任:积极参与公共安全项目,为智慧城市、交通管理等领域提供技术支持和服务。国际业务:除了国内市场外,海康威视的产品和服务也销往全球多个国家和地区。面向对象编程。

大模型大数据攻城狮的专栏 1764

兼容ie浏览器的placeholder的方法

原文章地址:https://www.cnblogs.com/maxiaodan/p/5337213.html(原文有三种方法) <style type="text/css" media="screen"> .phcolor { color: #666; } span { posi...

Angel Devil 787

视图库对接系列(GA-T 1400)一、简单介绍

GA/T 1400《公安视频图像信息应用系统》 是我们需要参考看看的相关文档,里面有对应的标准和介绍,没有这个文档的话可以加群找我要。群的话 我放在最下面了。我们先简单想几个问题, 也就是这个协议主要干什么用的,为什么要有, 能做什么。

qq_37716298的博客 4286

jQuery实现ie浏览器兼容placeholder效果

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery实现IE浏览器兼容placeholder效果</title> <style type="text/css"> ...

diebaiying3731的博客 128

FM20S用户手册--Linux系统启动卡制作及系统固化

评估板出厂时,默认提供一张配套的Micro SD卡,此卡为可正常使用的Linux系统 启动卡。评估板断电,将Linux系统启动卡插入评估板Micro SD卡槽,根据评估底板丝印将 启动方式选择拨码开关拨为1010(1-4).此档位为Micro SD启动模式。使用Linux 系统启动卡启动系统时,将使用此目录的BOOTbn文件启动FSBL和U-Boot。Linux系统启动卡制作时,已将固化系统的脚本文件mkemmcboot.sh拷贝至Linux系 统启动卡文件系统的"/opt/tools/"目录下。

创龙,嵌入式一体化解决方案商 302

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

【jquery】基于 jquery 实现 ie 浏览器兼容 placeholder 效果

placeholder 是 html5 新增加的属性,主要提供一种提示(hint),用于描述输入域所期待的值。该提示会在输入字段为空时显示,并会在字段获得焦点时消失。placeholder 属性适用于...

QDY5945的博客 188

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

jquery html() ie兼容,两种方法基于jQuery实现IE浏览器兼容placeholder效果

placeholder是HTML5的属性之一,在不同的浏览器( 支持HTML5的现代浏览器 )中会有略微不同的显示效果:在Chrome( v31.0.1650.63 m)、Firefox( v21.0 )、360安全( v6.3 极速模式 )中,输入栏获得焦点后,提示文字并不消失,如图( Chrome ):获得焦点前:获得焦点时:偏偏IE11要搞点特殊:获得焦点前:获得焦点时:也就是说获得焦点时提...

weixin_35782148的博客 572

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

两种方法基于jQuery实现IE浏览器兼容placeholder效果

placeholder是HTML5的属性之一,在不同的浏览器( 支持HTML5的现代浏览器 )中会有略微不同的显示效果: 在Chrome( v31.0.1650.63 m)、Firefox( v21.0 )、360安全( v6.3 极速模式 )中,输入栏获得焦点后,提示文字并不消失,如图( Chrome ): 获得焦点前: 获得焦点时: 偏偏IE11要搞点特

andybbc的博客 484

基于 jquery 实现 ie 浏览器兼容 placeholder 效果。

转载自品略网:http://www.pinlue.com/article/2020/03/0710/059990493435.html placeholder 是 html5 新增加的属性,主要提供一种提示(hint),用于描述输入域所期待的值。该提示会在输入字段为空时显示,并会在字段获得焦点时消失。placeholder 属性适用于以下类型的 input 标签:text, search,...

yihuliunian的博客 209

两种方法基于jQuery实现IE浏览器兼容placeholder效果【转】

文章出处:两种方法基于jQuery实现IE浏览器兼容placeholder效果 placeholder是HTML5的属性之一,在不同的浏览器( 支持HTML5的现代浏览器 )中会有略微不同的显示效果: 在Chrome( v31.0.1650.63 m)、Firefox( v21.0 )、360安全( v6.3 极速模式 )中,输入栏获得焦点后,提示文字并不消失,如图( Ch

踏歌行的专栏 670

关于input 属性placeholder 在IE9下兼容

今天分享下同事关于input 属性placeholder 在IE9下不兼容的解决方案,小弟不是很懂,希望有看完的大佬说说你们的理解 <script src="http://www.jq22.com/jquery/1.8.3/jquery.min.js"></script> <script> (function($){ $.fn.pl...

265

IE8,IE9简单实现placeholder

收到一个新需求,要改一个jsp项目的登录页,看了下设计图,感觉还好,要求兼容到IE8,,,也还好,基本是做出来了,到最后还剩一个placeholder的问题,网上查了一些方法,再结合自己的理解写了一下。 基本思路就是: 用户名和密码框后面分别放一个 span,作为假的 placeholder 占位,document.ready 的时候,判断浏览器是否支持placeholder,判断之...

Yana1225的博客 378

js实现IE9及以下对placeholder的兼容性

在做项目的时候,发现input的placeholder属性只支持i9以上的浏览器,ie9以下的就不显示信息提示了,体验很不好。最后自己用js实现了i9及以下placeholder的效果。 实现效果很简单,先说一下思路: 使用下面这个方法判断ie是否支持placeholder属性 function placeholderSupport() { return 'place...

hangzhang 731
上一篇: 让人又爱又恨得inline-block
下一篇: 日语韩语等常用正则表达式(笔记)
coder_chenz
博客等级 码龄10年 8粉丝 12原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值