Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda