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

84
Views
Javascript mouseover alert on div not working

Trying to get an alert to appear on mouseover, using Javascript, for a div element. I can get the div element to print in the console, but nothing else happens.

The div has some text in it, I tried changing it to activate on the text instead of the div but I still couldn't get it to work.

   window.onload = pageReady;
    function pageReady(){
            
        var buttonBox = document.getElementById("buttonBox");
        console.log(buttonBox);
        
        function askUser(){
            alert("It worked!");}
    
        buttonBox.onmouseover = askUser;
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Works for me? Show us your code if this sample isn't enough.

   window.onload = pageReady;
    function pageReady(){
            
        var buttonBox = document.getElementById("buttonBox");
        console.log(buttonBox);
        
        function askUser(){
            alert("It worked!");
        }
    
        buttonBox.onmouseover = askUser;
    }
<html>
<body>
<div id="buttonBox" height="100px" width="100px" style="background-color: red;">Text</div>
</body>
</html>

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!