お世話になっております。
今回、2つのテーブルを組み合わせて表を作成しているのですが、1つ目のheaderのwidthを2つ目のbodyと同じwidthにすることができずに困っています。
値を代入しても値が変更され、1pxずつずれるような形になっています。
テーブルの構成
html
1<div id="table_body"> 2 <table id="table"> 3 <thead> 4 <tr> 5 <th>aaa</th> 6 <th>bbb</th> 7 <th>ccc</th> 8 </tr> 9 </thead> 10 <tbody> 11 <tr> 12 <td>AAA</td> 13 <td>BBB</td> 14 <td>CCC</td> 15 </tr> 16 </tbody> 17 </table> 18</div> 19<div id="table_header"> 20 <table id="table"> 21 <thead> 22 <tr> 23 <th>aaa</th> 24 <th>bbb</th> 25 <th>ccc</th> 26 </tr> 27 </thead> 28 <tbody> 29 </tbody> 30 </table> 31</div>
javascript
1var $source = $('#table_body tr th'), 2 $dest = $('#table_header tr th'); 3$dest.width($source.width());
簡単ですがこのような感じで表記しています。
javascript内での代入ができていない状況です。
よろしくお願いします。
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/01/13 07:14