如何在输入密码字段内插入复选框 [英] How to insert a checkbox inside a input password field
本文介绍了如何在输入密码字段内插入复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望我的网页在密码字段内显示一个复选框.用户单击复选框,然后以文本形式看到密码.取消选中后,再次输入密码.
I want my web page to display a check box inside the password field. User clicks on the check box and see the password as text. On un-check, its password again.
这就是我想要的.这是从Ebay网站登录页面获得的.
This is what I want. This is from the Ebay website login page.
这就是我要得到的
我希望此复选框位于密码字段内.在此主题上我找不到任何在线内容.
I want this checkbox inside the password field. I could not find anything online on this topic.
这是我的代码:
<!-- Set a password for the account -->
<div class="col-md-12" style="margin: 7px;">
<input type="password" id="reg_password" name="reg_password" style="height: 35px;" class="form-control input-lg" placeholder="Password" ng-model="register_password" />
</div>
<input type="checkbox" id="eye" onclick="if(reg_password.type=='text')reg_password.type='password'; else reg_password.type='text';" />
推荐答案
只需添加CSS,然后将输入框将复选框移动到一个div组即可.参见示例
Just add CSS and move your checkbox to one group div with input text. See the example
#eye {
position:absolute;
right:50px;
top:6px;
}
这篇关于如何在输入密码字段内插入复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文