借助该插件可以轻松实现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>

posted on 2015-05-14 14:50  杨杨0708  阅读(712)  评论(0编辑  收藏  举报