jQuery live div width
<p>What I got is a div, that I attach to the body, I need to get the width of that div that I attach live. So this is my code:</p>

<pre><code>var iconDiv = $('&lt;div class="icon"&gt;&lt;/div&gt;');
iconDiv.appendTo('body');
console.log(iconDiv.width());
</code></pre>

<p>Now sometimes the iconDiv is the width of the body, and sometimes the width of the div is 30, which is the actual value of the div width, how can I solve this problem maybe with setTimeout ?</p>

<p>Thanks for you help</p>
