0

I have used a Jquery watermark to display text in the textboxes. The problem is that, when I fill the data in textboxes and without checking the terms and conditions checbox. The value in the textbox gets disappeared and the watermark text again comes. But when I click on the textbox again, the same value i can see. How is it happening. Please see my jquery code and HTMl for your reference:

<script src="../js/WaterMark.min.js" type="text/javascript"></script>
  <script type="text/javascript">
    $(function () {
        $("[id*=txtFirstName]").WaterMark();
    });
  </script>

HTML for the watermark:-

<tr>
 <td class="tdColName">Full Name<span style="color: #CF060D;">*</span></td>
 <td>
     <asp:TextBox ID="txtFirstName" runat="server" CssClass="txtFldName" ToolTip="Enter Your Full Name"></asp:TextBox>
 </td>
</tr>
Rahul Sutar
  • 260
  • 9
  • 36

2 Answers2

0

Try This:

<input type="text" value="Enter Your Name" onfocus="if (this.value == 'Enter Your Name') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Your Name';}">
Amy
  • 4,034
  • 1
  • 20
  • 34
0

Using the following jQuery plugin,You can create

http://digitalbush.com/files/jquery/watermarkinput/beta1/jquery.watermarkinput.js

HTML

<input type="text" id="txtFirstName"  />

JQuery

 $("#txtFirstName").Watermark("Enter Your Name");

FIDDLE DEMO

Shijin TR
  • 7,516
  • 10
  • 55
  • 122