jQuery : Chrome textareas and resize event jQuery : Chrome textareas and resize event google-chrome google-chrome

jQuery : Chrome textareas and resize event


It doesn't look like you can specifically attach events to resizing a textarea. The resize event fires when the window is resized.


I can't test this right now, but according to this forum entry it can be disabled using:

style="resize: none;"

unlike stated in that entry, max-width and max-height won't cut it - thanks to @Jonathan Sampson for the info.


Here's a jQuery plugin written using CoffeeScript. Idea from Jonathan Sampson.

$.fn.sizeId = ->                                                             return this.height() + "" + this.width()                             $.fn.textAreaResized = (callback) ->                                         this.each ->                                                                 that = $ this                                                            last = that.sizeId()         that.mousedown ->                                                            last = that.sizeId()                                                 that.mousemove ->                                                              callback(that.get(0)) if last isnt that.sizeId()             

You can build it to Javascript on the CoffeeScript's homepage

http://jashkenas.github.com/coffee-script/

Use the "Try CoffeeScript" button.