md-textarea-auto - any initialization required?


Topic: md-textarea-auto - any initialization required?

cdenby pro asked 7 years ago

https://mdbootstrap.com/components/inputs/#textarea says that all we need to do is put this class onto a text area and the resizing should happen. But I'm not seeing that behaviour. My textarea is inside a table>tbody>td, but I don't think that should cause a problem. What else needs to be done to make this happen? Using MDB Pro 4.5.3

cdenby pro answered 7 years ago

I guess I answered this myself by searching through the support questions. This has to be added to the js for the page and the last line has to be called after any dynamically loaded text areas appear. Why is this not in the description page for textarea for mdb??   jQuery.fn.extend({ autoHeight: function () { function autoHeight_(element) { return jQuery(element) .css({ 'height': 'auto', 'overflow-y': 'hidden' }) .height(element.scrollHeight); } return this.each(function() { autoHeight_(this).on('input', function() { autoHeight_(this); }); }); } }); $('textarea').autoHeight();

Bartłomiej Malanowski staff pro premium commented 7 years ago

Thank you for the tip. I've added this to our TODO list so I hope we'll add your code to our docs

Ingo Schubert commented 6 years ago

This information is still not on the doc page for textarea.

For dynamically added form fields the javascript above is absolutely required or the textarea doesn't render correctly.


Bartłomiej Malanowski staff pro premium commented 6 years ago

It's still on our TODO list


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No