<div class="signin-form u-password p-relative">
<span class="view-password"><i class="fas fa-eye"></i></span>
<input id="pass" class="pass" type="password" placeholder="Enter your password"/>
</div>
$('.view-password').on('click', function () {
let input = $(this).parent().find(".pass");
input.attr('type', input.attr('type') === 'password' ? 'text' : 'password');
});
$("#showpaswd").click(function () {
var x = document.getElementById("cpassword");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
});
$('#check').click(function(){
if(document.getElementById('check').checked) {
$('#test-input').get(0).type = 'text';
} else {
$('#test-input').get(0).type = 'password';
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type='password' id='test-input' /> Show password <input type='checkbox' id='check' />