質問編集履歴
1
内容の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,91 +1,37 @@
|
|
1
|
-
```
|
2
|
-
|
3
|
-
if (e.keyCode == 13) {
|
4
|
-
|
5
|
-
e.keyCode = 9;
|
6
|
-
|
7
|
-
}
|
8
|
-
|
9
|
-
```
|
10
|
-
|
11
|
-
の代わりになるもの方法を探しているのですが、どうもうまくいきません。
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
1
|
```
|
18
2
|
|
19
3
|
<script type="text/javascript">
|
20
4
|
|
21
|
-
|
5
|
+
$(window).load(function() {
|
22
6
|
|
23
|
-
|
7
|
+
$('input,select').on('keypress', function(ev){
|
24
8
|
|
25
|
-
|
9
|
+
var $me = $(this);
|
26
10
|
|
27
|
-
|
11
|
+
var $list = $('input:enabled:not([readonly]),select:enabled');
|
28
12
|
|
29
|
-
|
13
|
+
if (ev.keyCode == 13) {
|
30
14
|
|
31
|
-
|
15
|
+
$list.each(function(index){
|
32
16
|
|
17
|
+
if ($(this).is($me)) {
|
18
|
+
|
33
|
-
|
19
|
+
$list.eq(index+1).focus();
|
20
|
+
|
21
|
+
ev.preventDefault();
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
});
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
});
|
30
|
+
|
31
|
+
});
|
34
32
|
|
35
33
|
</script>
|
36
34
|
|
37
35
|
```
|
38
36
|
|
39
|
-
|
37
|
+
途中でフォーカスが移動しなくなるのですが、解決方法がわかりません。
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
```
|
44
|
-
|
45
|
-
<form action="/add" name="hoge" id="a" method="post" accept-charset="utf-8">
|
46
|
-
|
47
|
-
<div style="display:none;"><input type="hidden" name="_method" value="POST"/></div>
|
48
|
-
|
49
|
-
<table class="table table-striped ">
|
50
|
-
|
51
|
-
<tr>
|
52
|
-
|
53
|
-
<th>たいとる</th>
|
54
|
-
|
55
|
-
<td><input name="b" class="form-control" step="0.1" type="number" id="c"/></td>
|
56
|
-
|
57
|
-
</tr>
|
58
|
-
|
59
|
-
<tr>
|
60
|
-
|
61
|
-
<th>たいとる2</th>
|
62
|
-
|
63
|
-
<td><input name="d" class="form-control" step="0.1" type="number" id="e"/></td>
|
64
|
-
|
65
|
-
</tr>
|
66
|
-
|
67
|
-
<tr>
|
68
|
-
|
69
|
-
<th>たいとる3</th>
|
70
|
-
|
71
|
-
<td><input name="f" class="form-control" step="0.1" type="number" id="g"/></td>
|
72
|
-
|
73
|
-
</tr>
|
74
|
-
|
75
|
-
</table>
|
76
|
-
|
77
|
-
```
|
78
|
-
|
79
|
-
formはcake2の$this->Form->createによるものです。
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
jqueryの使用も考えたのですが、想定する順序にならなかったり、idやtabindexを指定しようにも実際は入力欄が非常に多いので手間だったり項目が変更になった際の見落としがあるのではないかと考えて。
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
普通にtabでの移動は想定通りの移動をしてくれるのでシンプルにtabを押したときと同様の挙動を
|
90
|
-
|
91
|
-
<button type="submit">にフォーカスがあるとき以外してほしい。
|