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

127
Views
add a triangle icon to the div opening and closing

I have the code where onclick of the link, i am opening and closing the div

here is the code

<div id="opendialog" style="display:none;">
      <div style="width:100%;height:200px;background:grey;"></div>
    </div>

the function

function openx() {
      var x= document.getElementById("opendialog");
      if (x.style.display === "none") {
        x.style.display = "block";
      } else {
        x.style.display = "none";
      }
    }

it works well but how can i add a traingle to the link when clicked it should show a traingle to the div, trying in a way that if the screen is small or bigger, the traingle should be placed properly under the link when clicked and should not be a problem

here is the html i have

<div onclick="openx()">+ Add <div>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use font-awesome icon for triangle up and down. You just need to add and remove class accordingly.

function openx() {
      var x= document.getElementById("opendialog");
      if (x.style.display === "none") {
        x.style.display = "block";
        document.getElementById("myIcon").innerHTML = "➖";
      } else {
      document.getElementById("myIcon").innerHTML = "➕";
        x.style.display = "none";
      }
    }
#myIcon {
margin-bottom: 3px;
font-size: 20px;
font-weight: bolder;
}

#myIcon:hover {
cursor: pointer;
}
<div onclick="openx()"><div id="myIcon">➕</div><div>

<div id="opendialog" style="display:none;">
      <div style="width:100%;height:200px;background:grey;"></div>
</div>

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!