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

167
Views
Haz que el contenido sea editable div, enfócate en el clic del botón

Tengo un div editable de contenido que estoy usando para recuperar algunos datos.

 <div contenteditable="true" ref="test">/*SomeText*/</div>

Después de ejecutar el enfoque a través de la ref con this.$refs.test.focus() . No funcionó y aparece un error en la consola (No se pueden leer las propiedades del focus de lectura undefined ) ¿Cómo puedo activar un efecto de enfoque en el div editable de contenido?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El atributo de contenido editable no debe ser content-editable="true" , sino contenteditable="true" .

 const App = { el: '#app', methods: { focusDiv() { this.$refs.test.focus() } } } const app = new Vue(App)
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div id="app"> <div contenteditable="true" ref="test">My Div</div> <button @click="focusDiv">Focus on div</button> </div>

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!