teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

テキストボックスに変更

2015/07/18 14:28

投稿

退会済みユーザー
answer CHANGED
@@ -5,7 +5,7 @@
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
8
- <meta charset="UTF-8">
8
+ <meta charset="UTF-8">
9
9
  </head>
10
10
  <body>
11
11
  <div>
@@ -20,14 +20,14 @@
20
20
  <input type="button" value="9" id="9">
21
21
  </div>
22
22
  <div>
23
- <span id="pass"></span>
23
+ <input type="text" id="pass" readonly>
24
24
  </div>
25
25
  <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
26
26
  <script>
27
27
  $(function(){
28
28
  $('input[type=button]').click(function(){
29
- if ($('#pass').html().length < 4) {
29
+ if ($('#pass').val().length < 4) {
30
- $('#pass').html($('#pass').html() + $(this).val());
30
+ $('#pass').val($('#pass').val() + $(this).val());
31
31
  }
32
32
  });
33
33
  });