resize() for any element

resize() for any element

I've been trying the resize() method but, as docs suggest (" The resize event fires when a document view is resized") you can only attach it to the $(window) object.

I have a <div> element. I use scripting to replace part of its contents. When its width changes I need to call my custom repositionBox() function. Currently, I've placed a call to repositionBox() after all the parts of the code that may result in width change. I wonder if there's a trick to simplify this mess; something similar to:

$("div#foo").resize(repositionBox) // This does nothing