回答編集履歴

1

sample

2018/11/22 07:38

投稿

yambejp
yambejp

スコア114835

test CHANGED
@@ -1,3 +1,143 @@
1
1
  - エラー用の列を予めつくっておくか
2
2
 
3
3
  - エラーをabsoluteな表示にするか
4
+
5
+
6
+
7
+ # sample
8
+
9
+
10
+
11
+ ```javascript
12
+
13
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
14
+
15
+ <script>
16
+
17
+ $(function(){
18
+
19
+ $('.error').css({
20
+
21
+ "position":"absolute",
22
+
23
+ "display":"block",
24
+
25
+ "top":0,
26
+
27
+ "left":function(){return $(this).closest('td').width()+5;},
28
+
29
+ });
30
+
31
+ });
32
+
33
+ </script>
34
+
35
+ <style>
36
+
37
+ #f1 table,#f2 table{border-collapse:collapse;}
38
+
39
+ #f2 table{margin:auto;}
40
+
41
+ #f1 table td,#f2 table td{border:solid 1px #000000;position:relative;}
42
+
43
+ </style>
44
+
45
+ dummy<br>
46
+
47
+ dummy<br>
48
+
49
+ dummy<br>
50
+
51
+ <form id="f1" action="" method="post">
52
+
53
+ <table>
54
+
55
+ <tr>
56
+
57
+ <td align="center">ID</td>
58
+
59
+ <td><input type="text" class="textfield" name="id">
60
+
61
+ <span class="error">error1</span>
62
+
63
+ </td>
64
+
65
+ </tr>
66
+
67
+ <tr>
68
+
69
+ <td align="center">PASS</td>
70
+
71
+ <td><input type="password" class="textfield" name="password">
72
+
73
+ <span class="error">error2error2error2error2</span></td>
74
+
75
+ </tr>
76
+
77
+ <tr>
78
+
79
+ <td colspan="2" align="center">
80
+
81
+ <input type="submit" class="btn" name="send" value="ログイン">
82
+
83
+ </td>
84
+
85
+ </tr>
86
+
87
+ </table>
88
+
89
+ </form>
90
+
91
+ dummy<br>
92
+
93
+ dummy<br>
94
+
95
+ dummy<br>
96
+
97
+ <form id="f2" action="" method="post">
98
+
99
+ <table>
100
+
101
+ <tr>
102
+
103
+ <td align="center">ID</td>
104
+
105
+ <td><input type="text" class="textfield" name="id">
106
+
107
+ <span class="error">error1</span>
108
+
109
+ </td>
110
+
111
+ </tr>
112
+
113
+ <tr>
114
+
115
+ <td align="center">PASS</td>
116
+
117
+ <td><input type="password" class="textfield" name="password">
118
+
119
+ <span class="error">error2error2error2error2</span></td>
120
+
121
+ </tr>
122
+
123
+ <tr>
124
+
125
+ <td colspan="2" align="center">
126
+
127
+ <input type="submit" class="btn" name="send" value="ログイン">
128
+
129
+ </td>
130
+
131
+ </tr>
132
+
133
+ </table>
134
+
135
+ </form>
136
+
137
+ dummy<br>
138
+
139
+ dummy<br>
140
+
141
+ dummy<br>
142
+
143
+ ```