Input type password Show Hide

      No Comments on Input type password Show Hide

Input type password Show Hide:

See the Pen Input type password Show Hide using JavaScript and jQuery by scanfcode (@scanfcode) on CodePen.

Input type password Show Hide-how it works?

Building HTML

   <div style="position: relative;">
          <span>PASSWORD</span>
          <input  name="password" type="password" class="password"/>
          <a id="s_show_hide" onclick="show();">SHOW</a>
    </div>

JavaScript to show and hide

    <script>
      function show()
       {
           if ($(".password").attr("type")=="password")
            {
                $(".password").attr("type", "text");
                document.getElementById('s_show_hide').innerHTML="HIDE";
            }
         else
            {
                $(".password").attr("type", "password");
                document.getElementById('s_show_hide').innerHTML="SHOW";
            }
      }
    </script>

Leave a Reply

Your email address will not be published. Required fields are marked *