Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Paragraph element doesn't want to be positioned

Hi I'm working on a drag and drop component website editor. So I added a button when you click it it shown an input element and your input becomes the text of an paragraph element that's pushed to an array everytime you do it My problem is that I want to make it so that when you click with the mouse the mouse x,y position becomes the left,top property of the paragraph element But it sends me an error that says: Cannot read properties of undefined (reading 'left') I already have the code that gets the mouse position so don't worry about it Here's the code

//imports
import {mouse} from '/mouse.js'
//variables
let text_data_holder = document.getElementById('text-field')
let text_data = ''
//Creating text
let text_array = []
text_button.addEventListener('click', function() {
  text_data_holder.style.display = 'block'
})
text_data_holder.addEventListener('change', function(e) {
   e.preventDefault()
   text_data += e.target.value
     for(let i = 0; i < 1; i++){
       text_array[i] = document.createElement('p')
       .innerText = text_data
       text_data_holder.after(text_array[i])
       console.log(text_data)
       text_array[i].left = mouse.x
    }
})
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda