Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

        function mouseOver(){
            document.getElementById("text").alert("Alert!");
        }

>Solution :

Try this

   function mouseOver(){
              alert("Alert!");
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading