79618413

Date: 2025-05-12 18:02:00
Score: 0.5
Natty:
Report link

You can do it with css.

document.querySelector(".clickedelement").addEventListener("click", function (e) {
  // add and remove border on div
});
div {
  width: 100px;
  height: 100px;
  background-color: yellow;
  border-radius: 50%;
  border: 2px solid #ff000000;
  transition: border 2s ease-out;
}

.clickedelement:active~div{
  border: 2px solid #ff0000;
  transition: border 100ms ease-out;
}
<p class="clickedelement">when this is clicked i want border added and removed (after 1s) on div below</p>
<div class=""></div>

Reasons:
  • RegEx Blacklisted phrase (1): i want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Sergey Soltanov