Skip to content

Instantly share code, notes, and snippets.


Adrien CHRETIEN adrienchretien

View GitHub Profile
adrienchretien / AutoSize.js
Created Dec 8, 2013
Resize an element when the visitor create(or remove) a new line on a text field (like a textarea)
View AutoSize.js
function AutoSize(textarea) {
textarea.className += ' js-autosize';
function resize() { = 'auto';
var height = textarea.scrollHeight;
if (window.getComputedStyle) {
var styles = window.getComputedStyle(textarea);