placeholder效果的jQuery插件,支持IE6、IE7
为IE添加placeholder支持功能,采用悬浮的span元素方式来模拟placeHolder,一般的,你在不输入的时候,会取到框内的值。此方法就没有这个担忧了。
<!DOCTYPE HTML> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>placeholder支持IE6/7</title> <script type="text/javascript" src="jquery.1.9.1.min.js"></script> <script type="text/javascript" src="jquery.placeholder1.0.js"></script> <script type="text/javascript"> $(function(){ $('input').placeholder({isUseSpan:true}); }) function getValue() { var textValue = $("#userName").val(); alert(textValue); } </script> </head> <body> <form> <label for="name">用户名</label> <input type="text" id="userName" placeholder="输入用户名"/> <input type="button" value="取值" onclick="getValue()"/> </form> </body> </html>
下面有两个js控件,加入即可
相关推荐
JM 2020-05-04
haidaoxianzi 2020-04-18
81570790 2020-04-16
攻城师 2013-05-14
haohong 2020-01-17
JM 2019-12-22
cherry0 2019-12-13
拭血 2019-11-17
hnyzyty 2019-11-04
zyhui 2019-09-08
wcssdu 2017-11-01
jiedinghui 2018-04-03
zZoOoOJaVa 2018-02-19
MayMatrix 2015-01-09
hualala 2019-07-01
LiteHeaven 2019-06-30