900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > jQuery插件EnPlaceholder实现输入框提示文字【jquery】

jQuery插件EnPlaceholder实现输入框提示文字【jquery】

时间:2023-11-07 04:02:17

相关推荐

jQuery插件EnPlaceholder实现输入框提示文字【jquery】

web前端|js教程

jQuery,EnPlaceholder,输入框提示文字

web前端-js教程

用法:

企业oa管理系统 源码下载,ubuntu系统如何卸载,启动tomcat7教程,recv爬虫介绍,php魔术总结,松江区seo推广服务哪家公司好lzw

首先在head中分别引入jQuery及本插件

网站浏览器apk源码下载,如何清除vscode的账号,ubuntu 关闭断口,前端发布到tomcat,枣树长爬虫,健身php源码,美容养生seo推广获客,好系统网站模板下载网站,php电影模板下载lzw

script> script>

然后就可以调用鸟

软件交易网站源码,vscode开始教程,ubuntu手机价格,爬虫 监控tomcat,共享sqlite 内存,阿里云服务器 上网,手指左右滑动插件,前端框架样例,steam 爬虫,php05,seo优化有哪些方式,网站gif小图标,照片墙 网页,c 用户界面模板,简单的幻灯效果页面,41邦订餐管理系统,模糊识别 算法 程序lzw

//通过value模拟placeholder $(input).placeholder(); //通过插入元素模拟placeholder $(input).placeholder({isUseSpan:true});

代码:

body { font: 12px/1.5 simsun; }form { width: 420px; height: 260px; margin: 20px auto 0; }h3 { font-weight: bold; margin: 10px 0; }p { margin-bottom: 10px; }input { vertical-align: middle; margin-left: 10px; height: 24px; line-height: 24px; width: 200px; padding-left: 2px; }textarea { vertical-align: middle; margin-left: 10px; width: 200px; height: 50px; font: inherit; padding-left: 2px; }.wrap-statistics { visibility: hidden; }html{color:#000;background:#fff;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,form,input,textarea,p,th,td,hr,button{margin:0;padding:0;}body,button,input,select,textarea{font:12px/1.5 tahoma,arial;}input,select,textarea{font-size:100%;}table{border-collapse:collapse;border-spacing:0;}th{text-align:inherit;}img{border:0;}iframe{display:block;}em,th{font-style:normal;font-weight:500;}ol,ul {list-style:none;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:500;}a{text-decoration:none;}a:hover{text-decoration:underline;}.fn-clear{zoom:1;}.fn-clear:after{visibility:hidden;display:block;font-size:0;content:".";clear:both;height:0;}.fn-hide{display:none;}.fn-left,.fn-right{display:inline;}.fn-left{float:left;}.fn-right{float:right;}.fn-hide-text{font-size:0;line-height:0;color:rgba(0,0,0,0);}.sl-wrap,.sl-wrap td,.sl-wrap th{word-wrap:break-word;word-break:break-all;} .sl-wrap-table{ table-layout:fixed; }

通过value方式模拟placeholder

$(#form1 input,#form1 textarea).placeholder();

在不支持placeholder的浏览器下,通过插入悬浮的span元素方式模拟

文本框内容改变时placeholder消失:

$(#username2,#password).placeholder({isUseSpan:true});

获得焦点时placeholder消失:

$(#address2).placeholder({isUseSpan:true,onInput:false});

$(#form1 input,#form1 textarea).placeholder(); $(#username2,#password).placeholder({isUseSpan:true}); $(#address2).placeholder({isUseSpan:true,onInput:false}); $(#remarks2).placeholder({isUseSpan:true});

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。