Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Show Password Checkbox

I am looking to use Django to create a form with a password field that can be toggled to be hidden or shown. This functionality can be seen on MailChimp at https://login.mailchimp.com/signup. Does anyone know how such a field could be created?

like image 634
sdotslezek Avatar asked Dec 20 '22 12:12

sdotslezek


1 Answers

it's just purely javascript :

<script type="text/javascript">
function reveal()
{
if(document.getElementById('box').checked)
   {document.getElementById("pw").type='text';}
else
document.getElementById("pw").type='password';
}
</script>   

<input type="checkbox" id="box" onclick ="reveal()">    
<input type="password" id="pw">
like image 69
slim_chebbi Avatar answered Dec 22 '22 10:12

slim_chebbi