jQuery Auto Expand Textarea

By Sam Deering

jQuery code to auto expand textarea input field on a form. The Plugin makes use of the scrollTop DOM property to gain the true height of the text and then applies that directly (or via animation) to the textarea.

Plugin Usage

    // On resize:
    onResize : function() {
    // After resize:
    animateCallback : function() {
    // Quite slow animation:
    animateDuration : 300,
    // More extra space:
    extraSpace : 40

Online Demo

Download Plugin




Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.