title: Show password button in rails devise
body: <p>In my rails am using devise for authentication, i want add a button near the password field on click of which user will be able to see what password they typed.</p>
  
  <p>I tried using javascript for this, added a checkbox and given it an onclcick function in the function if user clciks on the button the password type gets changes to text and vice versa.</p>
  
  <p>is something wrong here.</p>
  
  <pre><code>&lt;div class="form-group"&gt;
          &lt;div class="input-group" style="z-index: 0;"&gt;
              &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-lock"&gt;&lt;/i&gt;&lt;/span&gt;
              &lt;%= f.password_field :password, class: 'form-control password', autocomplete: "current-password", placeholder: "Your Password" %&gt;
              &lt;input type="checkbox" class="eye_icon" onclick="myFunction()"&gt;Show Password
          &lt;/div&gt;
      &lt;/div&gt;
  
  
  
  
  &lt;script&gt;
  $(".eye_icon").on('click',myFunction() {
      if ($(".password").attr('type') === 'password') {
          $(".password").attr('type', 'text');
      } else {
          $(".password").attr('type', 'password');
      }
  });
  &lt;/script&gt;
  </code></pre>