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

172
Vistas
How to detect the id of an element in js

So I'm making an idle game and I want a description to pop up at the bottom whenever you hover over a button. I've given each button an id and a class, the class is to detect when mouse over any button and the id to set the data for the description. FYI I'm using Jquery as well.

Here's the code:

HTML:

<button id="pick" class="shopButton">Pick a carrot</button>
<button id="refine" class="shopButton"Refine carrots</button>

JS:

$(".shopButton").mouseenter(function showDescription() {
    document.getElementById('description').style.display = "block";
    document.getElementById('descriptionHeader').innerHTML = 
    document.getElementById('descriptionText').innerHTML =
});

const pick = {
    header = "Header";
    text = "Text";
}

How should I do this?

I haven't tried anything yet because idk what would work (I'm fairly new to js)

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