Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I block Chrome’s <textarea> drag-to-expand feature?

In Chrome, the bottom right of <textarea> fields can be pulled to expand the text area. This has its advantages sometimes, but sometimes, it does not. (This discussion is for another time.)

What I want to know is how I can block this behaviour, if possible. I’m thinking something along the lines of some JS/jQuery dingus, but I don’t really know how Google programmed the feature.

Has anyone dabbled with this?

like image 247
Kiwi Avatar asked Feb 07 '11 18:02

Kiwi


Video Answer


1 Answers

Have you tried using CSS yet to stop this?

textarea {
  resize: none;
}

That should disable the drag-to-expand feature.

Update

You could also set this programmatically by using jQuery:

// CSS
textarea.no-expand {
  resize: none;
}

// jQuery
$('#my-text-area').addClass('no-expand');

Hope this helps!

like image 118
CalebHC Avatar answered Sep 19 '22 13:09

CalebHC