Attach a function to the focus event. The focus event occurs (display a message regarding the text field) when the <input> field gets focus.

<!DOCTYPE html>

<html>

<head>

         <title></title>

         <script

  src="https://code.jquery.com/jquery-3.5.1.slim.min.js"

  integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs="

  crossorigin="anonymous"></script>

</head>

<body>

         <from>

                 name<input type="text"id="name"><br>

                

         </from><br>

         <label></label>

<script type="text/javascript">

         $("input[type='text']").focus(function()

         {

                 $("input[type='text']").val("enter the name");

         });

</script>

</body>

</html>

 


Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post