Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4555512
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:14:10+00:00 2026-05-21T17:14:10+00:00

i just wanted to make a test, i’m used to work on jQuery but

  • 0

i just wanted to make a test, i’m used to work on jQuery but not on “plain” javascript, i tried to bind this event, but i’ve got no answer from the event, i just created a link and a script tag in the html code, with :

var li = document.getElementById(‘first’);
li.addEventListener(‘onMouseover’, function(){
alert(‘ok’);
})

Can you please tell me what is wrong with it? i don’t see the mistake.
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T17:14:10+00:00Added an answer on May 21, 2026 at 5:14 pm

    First, you need to drop the “on” part for addEventListener(). Second, the event name needs to be all lower case. Third, you were missing the third parameter, which is Boolean indicating whether to handle the event in the capturing phase rather than the bubbling phase (if in doubt, use false).

    The other issue you need to consider is that IE <= 8 does not support addEventListener(), so you need to include an IE-specific fallback using the proprietary attachEvent() method.

    With all this, your example becomes:

    var li = document.getElementById('first');
    if (typeof li.addEventListener != "undefined") {
        li.addEventListener('mouseover', function() {
            alert('ok');
        }, false);
    } else if (typeof li.attachEvent != "undefined") {
        li.attachEvent('onmouseover', function() {
            alert('ok');
        });
    }
    

    The easiest cross-browser solution is the so-called DOM0 method, using the element’s onmouseover property. However, this has the disadvantage of only allowing one event listener per event per element and is therefore potentially susceptible to being overridden by other code.

    li.onmouseover = function() {
        alert('ok');
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With jQuery you can make an ajax request like this: request=$.ajax({ url: test.html, });
I am planning to make an iPhone web application and I just wanted to
I have to write my own hash function. If I wanted to just make
Just wanted to write some recursion but can't check if the child is in
I was attempt to wrap some simple logic into a javascript/jquery closure to bind
I have an existing iPhone application, and I just wanted to make a static
I just discovered this issue, and I wanted to run it by everyone here
Edit: Just wanted to make the question I have more clear. I pretty much
Just wanted to know if anyone is really using Objects and Collections in Oracle
Just wanted to know if there is a big chance to inject SQL While

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.