diff --git a/jquery.autosize.js b/jquery.autosize.js index f478a82..67cb33b 100644 --- a/jquery.autosize.js +++ b/jquery.autosize.js @@ -155,7 +155,15 @@ setWidth(); } - mirror.value = ta.value + options.append; + if (!ta.value) { + // If the textarea is empty, copy the placeholder text into + // the mirror control and use that for sizing so that we + // don't end up with placeholder getting trimmed. + mirror.value = ($(ta).attr("placeholder") || '') + options.append; + } else { + mirror.value = ta.value + options.append; + } + mirror.style.overflowY = ta.style.overflowY; original = parseInt(ta.style.height,10);