Home >Web Front-end >JS Tutorial >jQuery implements adding watermark text effect to controls (source code attached)_javascript skills
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>
Click here for complete example codeDownload from this site.
I hope this article will be helpful to everyone in jQuery programming.