Skip to content

Instantly share code, notes, and snippets.

@KyleAMathews
Created November 29, 2011 22:28
Show Gist options
  • Save KyleAMathews/1406877 to your computer and use it in GitHub Desktop.
Save KyleAMathews/1406877 to your computer and use it in GitHub Desktop.
jQuery plugin for making textareas auto-exapand. Based on article at http://www.alistapart.com/articles/expanding-text-areas-made-elegant/
$ = jQuery
$.fn.makeExpandingArea = () ->
@.each ->
container = $(@)
area = container.find('textarea')
span = container.find('span')
area.on 'input', ->
span.text(area.val())
span.text(area.val())
# Enable extra CSS
container.addClass('active')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment