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

140
Views
Alert when mouse is hovering over text (HTML/Javascript

So I am writing a code that displays an alert box whenever the mouse hovers over a piece of text in HTML. The problem that I have is it is not working and I am not sure why. I tried finding help online but none of them worked. I need something that doesn't use JQuery for this assignment. What I have tried is to use function when activated with the mouse over event handler but that also didn't work.

This is my code:

        function mouseOver(){
            showAlert();
        }

        function showAlert(){
            alert("Alert!");
        }

This is another method that I have tried:

        function mouseOver(){
            document.getElementById("text").alert("Alert!");
        }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try this

   function mouseOver(){
              alert("Alert!");
}
about 4 years ago · Juan Pablo Isaza Report

0

You can use this

document.getElementById("text").addEventListener("mouseover", function( event ) {
  alert("Alert!");
}, false);
<p id="text">Hover Me</p>

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!