<label>Pass:
<input type=password placeholder="Enter Your Password" />
<i class="fa fa-eye"></i>
</label>
label{
position:relative;
}
input+i{
user-select:none;
cursor:pointer;
position:absolute;
right:3px;
top:2px;
}
document.querySelector('input[type="password"]+i')
.addEventListener('click', function(){
let i = this.previousElementSibling
i.type = i.type=='password' ? 'text': 'password'
this.classList.toggle('fa-eye-slash' )
})
This Pen doesn't use any external JavaScript resources.