The text inside the div is just a text-node, not an element you can get the width of. Just add an inner block-element:
<div id="box">
<div>Overflooooooooooow</div>
</div>
Edit:
Sorry, won't work with an inner div, as it inherits the parents width by default. Use a span:
<div id="box">
<span>Overflooooooooooow</span>
</div>