[SalesForce] Eye icon inside input password to show password

I'm very newbie in salesforce.
I have some task to show eyeicon in form input password to show password

Is that possible to create Eye icon in input type password instead using lightning:input or other else component?

This is my snippet code

<div class="formControl clearfix" style='height:50px'>
    <input type="password" name="password" id="password" ng-model="password" placeholder="{!$Label.LabelPassword}" style="width:100%" autocomplete="off"/>                

Best Answer

Please try below code with script and that should work. Replace Lead.text__c field with the required field of your choice. Also vote for the answer :-)

<script>function myFunction() {  var x = document.getElementById("PassId");  if (x.type === "password") {
x.type = "text";  } else {
x.type = "password";  }}</script> Enter Password : <input id="PassId" Required="True"  type="text"  onchange="document.getElementById('{!$Component.PassId}').value = this.value;" onclick="myFunction()" />  <apex:inputHidden value="{!Lead.text__c}" id="PassId" /><input type="checkbox" onclick="myFunction()">Show Password
Related Topic