user1556571
user1556571

Reputation:

Prevent text area ENTER behavior with autoresize height to content

I have a working text area that autoresize height according to input using JS function, I tried to add JS function to disable ENTER behavior adding new line but didn`t work.

<textarea id="title" name="title" class="autosize" placeholder="new post title" cols="42" rows="1">Post title</textarea>

http://jsfiddle.net/ihabovich/kepjdgnL/

Upvotes: 1

Views: 58

Answers (1)

Giwan
Giwan

Reputation: 1590

Are you using internet explorer perhaps. It seems to work fine in the three browsers I was able to test in (Safari, Chrome and FF)

If you are using IE then have a look at this solution. event.preventDefault() function not working in IE

Upvotes: 1

Related Questions