title: jQuery Show Password
body: <p>I am trying to make where if the user clicks on the checkbox, it shows the password in the inputbox as text. And if he/she unchecks, it sets the attribute to password. Any pointers?</p>
  
  <p>Code: </p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script type='text/javascript' src='jquery-3.1.1.min.js'&gt;&lt;/script&gt;
      &lt;script type='text/javascript' src='jquery-ui/jquery-ui.js'&gt;&lt;/script&gt;
  
      &lt;script type='text/javascript'&gt;
          $(document).ready(function(){
              $('#check').click(function(){
                  if($('test-input').attr('type', 'text'));
              });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;input type='password' id='test-input' /&gt; Show password &lt;input type='checkbox' id='check' /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>