Javascript Auto Expand Textarea - Dewa Blogger

Halaman

    Social Items

Buy Now

Javascript Auto Expand Textarea

Versi Dasar

function expandTextarea(id) {     document.getElementById(id).addEventListener('keyup', function() {         this.style.overflow = 'hidden';         this.style.height = 0;         this.style.height = this.scrollHeight + 'px';     }, false); }

Penggunaan

expandTextarea('id-textarea');

Lihat Demo

Dalam Bentuk Plugin jQuery (Dengan Sedikit Perubahan)

/**  * TextAreaExpander plugin for jQuery  * v1.0  * Expands or contracts a textarea height depending on the  * quatity of content entered by the user in the box.  *  * By Craig Buckler, Optimalworks.net  * With some modification by Taufik  * As featured on SitePoint.com:  *  " rel="nofollow" target="_blank">TextAreaExpander Demonstration


Sumber https://www.dte.web.id/