質問編集履歴

2

プログラムを追記

2017/08/24 18:50

投稿

aglkjggg
aglkjggg

スコア769

test CHANGED
File without changes
test CHANGED
@@ -14,6 +14,58 @@
14
14
 
15
15
 
16
16
 
17
+ ```HTML
18
+
19
+ <input id="text1" type="text" placeholder="1">
20
+
21
+ <input id="text2" type="text" placeholder="2">
22
+
23
+ <input id="text3" type="text" placeholder="3">
24
+
25
+ ```
26
+
27
+ ```js
28
+
29
+ $('#text1').on('keyup', function (e) {
30
+
31
+ if (e.keyCode == 13) {
32
+
33
+ $('#text2').focus();
34
+
35
+ }
36
+
37
+ });
38
+
39
+
40
+
41
+ $('#text2').on('keyup', function (e) {
42
+
43
+ if (e.keyCode == 13) {
44
+
45
+ $('#text3').focus();
46
+
47
+ }
48
+
49
+ });
50
+
51
+
52
+
53
+ $('#text3').on('keyup', function (e) {
54
+
55
+ if (e.keyCode == 13) {
56
+
57
+ $('#text1').focus();
58
+
59
+ }
60
+
61
+ });
62
+
63
+ ```
64
+
65
+
66
+
67
+
68
+
17
69
  ### Ⅱ. 実現したいこと
18
70
 
19
71
  2点あります。
@@ -54,6 +106,114 @@
54
106
 
55
107
 
56
108
 
109
+ ```HTML
110
+
111
+ <button id="button1">追加する</button>
112
+
113
+
114
+
115
+ <div id="inputs">
116
+
117
+ <input id="text1" type="text" placeholder="1">
118
+
119
+ <input id="text2" type="text" placeholder="2">
120
+
121
+ <input id="text3" type="text" placeholder="3">
122
+
123
+ </div>
124
+
125
+ ```
126
+
127
+
128
+
129
+ ```js
130
+
131
+ let input_text_count = 3;
132
+
133
+
134
+
135
+ $('#button1').on('click', function (e) {
136
+
137
+ input_text_count++;
138
+
139
+
140
+
141
+ $("<input>", {
142
+
143
+ type: 'text',
144
+
145
+ id: 'text' + input_text_count,
146
+
147
+ placeholder: input_text_count
148
+
149
+ }).appendTo('#inputs');
150
+
151
+ });
152
+
153
+
154
+
155
+ $('#text1').on('keyup', function (e) {
156
+
157
+ if (e.keyCode == 13) {
158
+
159
+ $('#text2').focus();
160
+
161
+ }
162
+
163
+ });
164
+
165
+
166
+
167
+ $('#text2').on('keyup', function (e) {
168
+
169
+ if (e.keyCode == 13) {
170
+
171
+ $('#text3').focus();
172
+
173
+ }
174
+
175
+ });
176
+
177
+
178
+
179
+ $('#text3').on('keyup', function (e) {
180
+
181
+ if (e.keyCode == 13) {
182
+
183
+ $('#text4').focus();
184
+
185
+ }
186
+
187
+ });
188
+
189
+
190
+
191
+ $('#text4').on('keyup', function (e) {
192
+
193
+ if (e.keyCode == 13) {
194
+
195
+ $('#text5').focus();
196
+
197
+ }
198
+
199
+ });
200
+
201
+
202
+
203
+ $('#text5').on('keyup', function (e) {
204
+
205
+ if (e.keyCode == 13) {
206
+
207
+ $('#text1').focus();
208
+
209
+ }
210
+
211
+ });
212
+
213
+ ```
214
+
215
+
216
+
57
217
  ### 補足情報(言語/FW/ツール等のバージョンなど)
58
218
 
59
219
  - Windows 10 64bit

1

Markdownの言語を修正

2017/08/24 18:50

投稿

aglkjggg
aglkjggg

スコア769

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  どのように書けば1つにまとめることができ、汎用性を高める事が出来ますでしょうか?
28
28
 
29
- ```
29
+ ```js
30
30
 
31
31
  $('#text1').on('keyup', function (e) {
32
32