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

215
Views
popup function in html

I am new to HTML coding and JavaScript.

I am preparing a report in HTML displaying popup's and associated messages multiple times.

I came to know that id should be unique.

Can anyone help me with code if there is another way of achieving the requirement

function dFunc() {
  var popup = document.getElementById(id);
  popup.classList.toggle("show");
}
<div onclick='dFunc()'>
  OK
  <span class='popuptext' id='dPopup'>
    Message
  </span>
</div>

<div onclick='dFunc()'>
  OK
  <span class='popuptext' id='LPopup'>
    Something
  </span>
</div>

<div onclick='dFunc()'>
  OK
  <span class='popuptext' id='SPopup'>
    new thing
  </span>
</div>

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

0

function dFunc(){ var popup = document.getElementById('dPopup') popup.classList.toggle("visible");}

Avoid using onclick in the HTML Pages..

Have Look at this Link and next time try to google stuff before you submit a request.

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!