1 $("#showpaswd").click(function () {
2 var x = document.getElementById("cpassword");
3 if (x.type === "password") {
4 x.type = "text";
5 } else {
6 x.type = "password";
7 }
8 });
1$('#check').click(function(){
2 if(document.getElementById('check').checked) {
3 $('#test-input').get(0).type = 'text';
4 } else {
5 $('#test-input').get(0).type = 'password';
6 }
7});
8
9<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
10<input type='password' id='test-input' /> Show password <input type='checkbox' id='check' />