我想要将输入字段的类型从文本更改为密码。如何更改按键上的输入字段的类型 - angularjs
在点击输入字段时,我可以将文本类型从文本更改为密码,但我也想在选项卡图标的按键上将文本类型更改为密码。
任何人都可以帮助我。
我的代码改变从文字上的onclick功能密码类型是
<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 {
/*color:#999;*/
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%;
/*width:100px; */
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;
}
分享自己的所有到目前为止已经试过..也许一个plunker /小提琴? – tanmay
你可以使用javascript/jquery。? – Chirag