借助该插件可以轻松实现HTML5中placeholder特效:
实例代码如下:
<script type="text/javascript" src="<%=basePath%>js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jquery.placeholder.js"></script>
<script type="text/javascript">
$(function() {
$('input, textarea').placeholder();
});
</script>
<style type="text/css">
input, textarea { font-family: Helvetica, Arial; color: #000;}
.placeholder {color: #aaa;}
</style>
</head>
<input type="text" id="userName" name="userName" placeholder="请输入用户名…" style="margin-bottom: 12px;"><br>
<input type="password" id="password" name="password" placeholder="请输入密码…" style="margin-bottom: 12px;"><br>
<textarea id="personalInformation" name="personalInformation" rows="3" cols="50" maxlength="200" placeholder="请输入个人信息…"></textarea>