回答編集履歴

1

sample

2016/09/26 08:44

投稿

yambejp
yambejp

スコア114850

test CHANGED
@@ -1 +1,107 @@
1
1
  一行で表示するもの用意しておいて、読み込み後2行に変換してみては?
2
+
3
+
4
+
5
+ # サンプル
6
+
7
+ たとえばこんな感じでどうでしょうか?
8
+
9
+ ```script
10
+
11
+ $(function(){
12
+
13
+ $('th.shosai').remove();
14
+
15
+ $('td.shosai').each(function(){
16
+
17
+ var parent_tr=$(this).parent('tr');
18
+
19
+ var new_tr=document.createElement('tr');
20
+
21
+ $(this).get(0).setAttribute('colspan','4');
22
+
23
+ $(this).remove().appendTo(new_tr);
24
+
25
+ parent_tr.after(new_tr.outerHTML);
26
+
27
+ });
28
+
29
+ });
30
+
31
+
32
+
33
+ ```
34
+
35
+
36
+
37
+ ```HTML
38
+
39
+ <table border>
40
+
41
+ <thead>
42
+
43
+ <tr>
44
+
45
+ <th>日付</th>
46
+
47
+ <th>名前</th>
48
+
49
+ <th>出身地</th>
50
+
51
+ <th>ステータス</th>
52
+
53
+ <th class="shosai">詳細</th>
54
+
55
+ </tr>
56
+
57
+ </thead>
58
+
59
+ <tbody>
60
+
61
+ <tr>
62
+
63
+ <td>2000/10/10</td>
64
+
65
+ <td>徳川家康</td>
66
+
67
+ <td>愛知県</td>
68
+
69
+ <td>良好</td>
70
+
71
+ <td class="shosai">詳細テキスト</td>
72
+
73
+ </tr>
74
+
75
+ <tr>
76
+
77
+ <td>2000/10/10</td>
78
+
79
+ <td>徳川家康</td>
80
+
81
+ <td>愛知県</td>
82
+
83
+ <td>良好</td>
84
+
85
+ <td class="shosai">詳細テキスト</td>
86
+
87
+ </tr>
88
+
89
+ <tr>
90
+
91
+ <td>2000/10/10</td>
92
+
93
+ <td>徳川家康</td>
94
+
95
+ <td>愛知県</td>
96
+
97
+ <td>良好</td>
98
+
99
+ <td class="shosai">詳細テキスト</td>
100
+
101
+ </tr>
102
+
103
+ </tbody>
104
+
105
+ </table>
106
+
107
+ ```