Jquery: need to set width of div inside table
<p>Right now im trying to grab the ul and put it under the expanded tr when clicked (to make it seem expanded). It moves the ul but it stays the width of the first th in the thead. I need the ul to be able to move the entire width of the table.</p>

<pre><code>&lt;table&gt;
&lt;thead&gt;
    &lt;tr&gt;
        &lt;th class="header"&gt;number&lt;/th&gt;
        &lt;th class="header"&gt;details&lt;/th&gt;
        &lt;th class="header"&gt;first name&lt;/th&gt;
        &lt;th class="header"&gt;last name&lt;/th&gt;
    &lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt; 
        &lt;tr&gt;
        &lt;td&gt;12345&lt;/td&gt;
        &lt;td class="expandable"&gt;Description
            &lt;ul&gt;
                &lt;li&gt;&lt;b&gt;Sed ut:&lt;/b&gt; perspiciatis unde omnis  error sit voluptatem&lt;/li&gt;
                &lt;li&gt;&lt;b&gt;Sed ut:&lt;/b&gt; perspiciatis unde omnis  error sit voluptatem&lt;/li&gt;
                &lt;li&gt;&lt;b&gt;Sed ut:&lt;/b&gt; perspiciatis unde omnis  error sit voluptatem&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/td&gt;
        &lt;td&gt;john&lt;/td&gt;
        &lt;td&gt;smith&lt;/td&gt;
    &lt;/tr&gt;
&lt;/tbody&gt;
</code></pre>

<p></p>

<p>here the js </p>

<pre><code>function legDesc(el){
el.click(function(){

var bag = $(this)
var width = bag.width()
var desc = bag.find('ul')
var parent = bag.parent()
bag.prev().css('width', width)

if($('.leg-desc ul').length &gt; 0){
        desc.insertAfter(parent)
}else{
        var ul = el.parent().next()
        parent.next().prev().find('.leg-desc').append(ul)
}
bag.parents('tr').toggleClass('expanded')
})
}
  legDesc($('.leg-desc'))
</code></pre>
