I mixed vol7ron's answer up a bit, and just replaced the "Resize Action Here" with a simple trigger of the normal "resize" event, so you can attach whatever you want to happen to the resize event "as usual":
$(document).ready(function(){
$('textarea').bind('mouseup mousemove',function(){
if(this.oldwidth === null){this.oldwidth = this.style.width;}
if(this.oldheight === null){this.oldheight = this.style.height;}
if(this.style.width != this.oldwidth || this.style.height != this.oldheight){
$(this).resize();
this.oldwidth = this.style.width;
this.oldheight = this.style.height;
}
});
});
I added the mousemove event so the resizing also fires while dragging the mouse around while resizing, but keep in mind that it fires very often when you move the mouse around.
in this case you might want to put a little delay in actually triggering or handling the resizing event, e.g.
replace the above:
$(this).resize();
with:
if(this.resize_timeout){clearTimeout(this.resize_timeout);}
this.resize_timeout = setTimeout(function(){$(this).resize();},100);
example usage, make 2nd textarea grow and shrink with the first one:
$('textarea').eq(0).resize(function(){
var $ta2 = $('textarea').eq(1);
$('textarea').eq(1).css('width',$ta2.css('width')).css('height',$ta2.css('height'));
});