jQuery - Detect when textarea is resized

bind, jquery, resize, textarea

Solution

DEMO

$(document).ready(function () {
    var $textareas = jQuery('textarea');

    // set init (default) state   
    $textareas.data('x', $textareas.outerWidth());
    $textareas.data('y', $textareas.outerHeight());

    $textareas.mouseup(function () {

        var $this = $(this);

        if ($this.outerWidth() != $this.data('x') || $this.outerHeight() != $this.data('y')) {
            alert($this.outerWidth() + ' - ' + $this.data('x') + '\n' + $this.outerHeight() + ' - ' + $this.data('y'));
        }

        // set new height/width
        $this.data('x', $this.outerWidth());
        $this.data('y', $this.outerHeight());
    });
});

Problem

I am trying to detect whenever the user resizes a resizable textarea.. I am trying to do it with this code but it doesn't work: ``` $('textarea.note').bind("resize", function(){ alert("resize!!!!!"); }) ``` I don't want really to use any kind of timer and loops.. Help!?

Original source

Related problems