I need help changing an input field type from text to password.
Currently, I am able to change the input field type from text to password when clicking on it. However, I also want the type to change from text to password when tab is pressed.
Any assistance would be appreciated.
The code snippet where I am currently changing the type on click function is as follows:
<input type="text" name="password" class="form-control5 floating-input" ng-model="vm.password" required autocomplete="off" onclick="(this.type='password')" value="secure"/>
<span class="highlight"></span>
<span class="bar"></span>
<label for="password" class="field-name">Password</label>
label {
font-size:16px;
font-weight:normal;
position:absolute;
pointer-events:none;
left:5px;
top:10px;
transition:0.2s ease all;
}
.highlight {
position:absolute;
height:60%;
top:25%;
left:0;
pointer-events:none;
opacity:0.5;
}
.floating-label {
position:relative;
margin-bottom:20px;
}
.floating-input , .floating-select {
font-size:14px;
padding:4px 4px;
display:block;
width:100%;
height:30px;
background-color: transparent;
border:none;
border-bottom:1px solid #ccc;
}
.floating-input:focus , .floating-select:focus {
outline:none;
}
.floating-input:focus ~ label, .floating-input:not([value=""]):valid ~ label {
top:-18px;
font-size:14px;
color:#333;
font-weight: 600;
}