Home > Web Front-end > JS Tutorial > body text

jQuery implements adding watermark text effect to controls (source code attached)_javascript skills

WBOY
Release: 2016-05-16 15:28:14
Original
1475 people have browsed it

The example in this article describes the jQuery implementation of adding watermark text effects to controls. Share it with everyone for your reference, the details are as follows:

The screenshot of the running effect is as follows:

The online demo address is as follows:

http://demo.jb51.net/js/2015/jquery-text-add-txt-style-codes/

The specific code is as follows:

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
  <title>WaterMark</title> 
  <script src="jquery-1.7.2.min.js" type="text/javascript"></script> 
  <script src="jquery.tinywatermark.js"type="text/javascript"></script> 
  <script type="text/javascript" language="javascript"> 
  $(function() 
  {    
    $("input[title='Month']").watermark('watermark','Title'); 
    $("textarea[title='Content']").watermark('watermark','Please input the content !');; 
  }); 
  </script> 
  <style type="text/css"> 
  .watermark {color:#999;} 
  </style> 
</head> 
<body> 
  <form id="form1" runat="server"> 
  <div> 
  <div><input title="Month"/></div> 
  <div><textarea id="TextArea1" cols="20" rows="2" title="Content"></textarea></div> 
  </div> 
  </form> 
</body>
</html>

Copy after login

Click here for complete example codeDownload from this site.

I hope this article will be helpful to everyone in jQuery programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template