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

303
Views
Conflict between onmouseover and onmouseout when using inline

I am trying to just get a small css change done based on user moving mouse on or off an element. The onMouseOver event works fine, but when I try to reset the css after the user moves the mouse off using onMouseOut nothing appears to happen.

Here is a fiddle: https://jsfiddle.net/2awspkeb/3/

And here is the code:


<p>CSS Box Model was revolutionary because it established from there on out all HTML elements would be considered
<span class="box" style="color:red;" 
onMouseOver="let elements = document.querySelectorAll('*');
             for (let i = 0; i < elements.length; i++){
             elements[i].style.border = 'solid .75px black';
             }
             onmouseout
             for (let i = 0; i < elements.length; i++){
             elements[i].style.border = 'none';
             }">
  “boxes”</span><
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You just needed to add the onMouseOut...

<span class="box" style="color:red;" 
onMouseOver="let elements = document.querySelectorAll('*');
         for (let i = 0; i < elements.length; i++){
         elements[i].style.border = 'solid 0.75px black';
         }"
onMouseOut=" let elements = document.querySelectorAll('*');
         for (let i = 0; i < elements.length; i++){
         elements[i].style.border = 'none';
         }">“boxes”</span>

Oliver

about 4 years ago · Santiago Trujillo 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!