PlaceHolder in HTML

The placeholder attribute displayed text in the input or textarea field before the user enters a value. Placeholder is very useful when your requirement is show hint on input and when users enter some value then hint should be removed.

HTML5 has introduced many new features. The Placeholder is also new feature in HTML5 and it supported in all new browser.

You can also complete this work with the help of jquery or JavaScript but in this case you have to write dozed line of code.

CODE
<!DOCTYPE html>
<html>
<head>
  <title>jQuery With Example</title>
  <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
  <script type="text/javascript">
    $(function () {
      $('.btnGetName').click(function () {
        alert($('.txtName').val());
      });

    });
  </script>
</head>
<body>
  <div class="Container">
    <input type="text" class="txtName" placeholder="Enter Name" />
    <button type="button" class="btnGetName">Get Name</button>
  </div>
</body>
</html>
DISPLAY

No comments :

Please Give Your Feedback