Resize on div element

javascript, jquery

Solution

`DIV` does not fire a `resize` event, so you won't be able to do exactly what you've coded, but you could look into monitoring DOM properties.

If you are actually working with something like resizables, and that is the only way for a div to change in size, then your resize plugin will probably be implementing a callback of its own.

Problem

jQuery has the `resize()` - event, but it just work with window. ``` jQuery(window).resize(function() { /* What ever */ }); ``` This works fine! But when I want to add the event to a div element it doesn't work. E.g. ``` jQuery('div').resize(function() { /* What ever */ }); ``` I want to start an callback when the size of a div-element has changed. I don't want to start a resizable - event – just a event to check if the size of a div - element has changed. Is there any solution to do this?

Original source