0

I am using vue

I want to auto increment the input by using my input component.

<input
      type="text"
      v-model="inputValue"
      :placeholder="placeholder"
      oninput="this.size = this.value.length"
      @keyup="handleInput"
      @blur="handleBlur"
      style="max-width: 100%" />

My Problem is that the content has always more space than needed. example

enter image description here

When using a span the problem doesn't seem to appear.

  <span
        class="input"
        role="textbox"
        :data-placeholder="placeholder"
        oninput="this.size = this.value.length"
        contenteditable="true"
        @keyup="handleInput"
        style="max-width: 100%; min-width: 100%">
        {{ value }}
      </span>

enter image description here

How can I get rid of this space using an Input?

<input
      type="text"
      v-model="inputValue"
      :placeholder="placeholder"
      oninput="this.size = this.value.length"
      @keyup="handleInput"
      @blur="handleBlur"
      style="max-width: 100%" />
      
Non404
  • 1,130
  • 2
  • 12
  • 22
  • 1
    The answer is given here already https://stackoverflow.com/questions/3392493/adjust-width-of-input-field-to-its-input – Developer May 05 '23 at 15:28
  • 1
    Does this answer your question? [Adjust width of input field to its input](https://stackoverflow.com/questions/3392493/adjust-width-of-input-field-to-its-input) – PK_ May 06 '23 at 09:05

0 Answers0