使用带有jQuery的复选框将密码字段更改为文本 [英] Changing password field to text with checkbox with jQuery
本文介绍了使用带有jQuery的复选框将密码字段更改为文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过复选框选中取消选中密码字段到文本和密码?
How can I toggle a password field to text and password with a checkbox check uncheck?
推荐答案
这就是你看的for ??
is this what you looking for ??
<html>
<head>
<script>
function changeType()
{
document.myform.txt.type=(document.myform.option.value=(document.myform.option.value==1)?'-1':'1')=='1'?'text':'password';
}
</script>
</head>
<body>
<form name="myform">
<input type="text" name="txt" />
<input type="checkbox" name="option" value='1' onchange="changeType()" />
</form>
</body>
</html>
这篇关于使用带有jQuery的复选框将密码字段更改为文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文