Textarea Auto height

It can be achieved using JS. Here is a ‘one-line’ solution using elastic.js: Updated: Seems like elastic.js is not there anymore, but if you are looking for an external library, I can recommend autosize.js by Jack Moore. This is the working example: Check this similar topics too: Autosizing textarea using Prototype Textarea to resize based on content length Creating … Read more

var.replace is not a function

My guess is that the code that’s calling your trim function is not actually passing a string to it. To fix this, you can make str a string, like this: str.toString().replace(…)…as alper pointed out below.

++someVariable vs. someVariable++ in JavaScript

Same as in other languages: ++x (pre-increment) means “increment the variable; the value of the expression is the final value” x++ (post-increment) means “remember the original value, then increment the variable; the value of the expression is the original value” Now when used as a standalone statement, they mean the same thing: The difference comes when you … Read more