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

174
Views
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
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!