-1

How can I make an INPUT field dynamically change itself into a TEXTAREA in the browser, based on certain conditions (like the amount of text in it), without any extra logic server-side?

I have not tried anything yet, because I don't want to reinvent the wheel. I searched SO and found nothing. I'm looking for something like:

$('#myinputfield').automatically_morph_input_type_based_on_contents();
Alex R
  • 11,364
  • 15
  • 100
  • 180

1 Answers1

0

I doubt you'll find anything that is already prebuilt.

A simple thing you should consider is that, whether you really need an input or a textarea. And if you still think you need to switch between the too then you'll just have to dynamically create the two.

First remove the old element, create the new element, use the value, id, name and other attributes from the old element. Apply the same process for the next change.