Skip to content

Instantly share code, notes, and snippets.

@oppara
Forked from miyamae/input_pssword.html
Created October 12, 2012 14:02
Show Gist options
  • Select an option

  • Save oppara/3879321 to your computer and use it in GitHub Desktop.

Select an option

Save oppara/3879321 to your computer and use it in GitHub Desktop.
パスワードを伏せずに入力できるようにする
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function() {
var changeMaskPasswd = function() {
$('.passwd')[0].type =
$('.mask-passwd')[0].checked ? 'password' :'text';
}
$('.mask-passwd').click(function() {
changeMaskPasswd();
});
changeMaskPasswd();
});
</script>
</head>
<body>
<form method="POST" action="login">
ユーザー名:
<input type="text" name="username"><br>
パスワード:
<input class="passwd" type="password" name="password" autocomplete="off"><br>
<label><input type="checkbox" checked="checked"
class="mask-passwd">パスワードを伏せる</label>
<br><input type="submit" value="ログイン">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment