search

Home  >  Q&A  >  body text

javascript - Make input extend automatically?

Assume that when the text is less than one line at the beginning, it will be an input-sized field
But when it jumps to the second line, the input height will also change automatically?
Just like when writing a title in WordPress, if the text exceeds the input range, will it automatically extend downwards?

Screen Shot 2017-06-10 at 11.42.08 PM.png

Screen Shot 2017-06-10 at 11.42.21 PM.png

天蓬老师天蓬老师2779 days ago673

reply all(2)I'll reply

  • phpcn_u1582

    phpcn_u15822017-06-12 09:25:09

    In this case, textarea is usually used, but if you have to use input, you have to use js to calculate the height, and then set the height of the input. It seems a bit troublesome to calculate

    reply
    0
  • ringa_lee

    ringa_lee2017-06-12 09:25:09

    Then use textarea

    reply
    0
  • Cancelreply