Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
Get value from span input-textbox in vue

I'm new to Vue. I'm trying to create an auto-growing input. I have found out that there is no way to create real <input> which fits its content (where I can use v-model for changing the value). So I created a <span> which acts like an input. But I can't get the input value out of it after changing it.

To sum up the functionality – my "speed" value can be adjusted by buttons + and - (works), or by typing new number (does not work).

My code:

<script setup>
    import { ref } from 'vue'

    const speed = ref(20)

    function minus() {
        speed.value--
    }

    function plus() {
        speed.value++
    }
</script>

<template>
    <h2>Speed:</h2>
    <button @click="minus">−</button>
    <span class="input" role="textbox" contenteditable>{{speed}}</span>
    <button @click="plus">+</button>
</template>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could try this:

<textarea @input="$el.style.height = `${$el.scrollHeight}px`"></textarea>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!