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

  • SEARCH
  • Home
  • 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 8030983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:56:51+00:00 2026-06-05T00:56:51+00:00

An onmouseover over a cell generates a div inside that cell. That div has

  • 0

An onmouseover over a cell generates a div inside that cell. That div has an onclick, but this onclick is not executed. Here’s some sample code: JSFiddle

JavaScript:

var oldCell='';
function addDiv(cell){
    if(oldCell != ''){
        oldCell.innerHTML = '';
    }
    cell.innerHTML = "<div class='innerDiv' onclick='console.log(this.parentNode);'></div>";
    oldCell = cell;
} 

HTML

<table border='1px solid black'>
    <tr>
        <td class='cell' onmouseover='addDiv(this)'></td>
        <td class='cell' onmouseover='addDiv(this)'></td>
    </tr>
     <tr>
        <td class='cell' onmouseover='addDiv(this)'></td>
        <td class='cell' onmouseover='addDiv(this)'></td>
    </tr>
</table>​

I’ve tried focusing on the div, but this does not wok either. I’ve also tried giving the cell the onclick, and then focusing on the cell instead of the div, but this doesn’t work in Chrome, does in Firefox though.

  • 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-06-05T00:56:52+00:00Added an answer on June 5, 2026 at 12:56 am

    It appears that the mouseover event is creating a new object inside of it everytime the “mouseover” event is called. Clicking on the object fires a mouseover event, which is likely replacing the element and therefore making it impossible to call an onclick event.

    My guess at the event list:
    – Mouseover
    – Mousedown -> Mouseover
    – Object replaced.
    – Mouseup (doesn’t count as click, because a new object is receiving only mouse up)


    Edit:

    If your goal is to just create a mousehover effect then you should use CSS’s hover keyword.

    See this fiddle that does essentially what you are trying to do: http://jsfiddle.net/Tb2kK/27/


    Edit: To do it similar to how you’re doing it, you need to check if a div already exists. One way would be to assign an id: http://jsfiddle.net/mZdpN/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to make a displaying list with onmouseover() with some links but they
A line created using the DrawLine method of wx.DC has the onClick and onMouseOver
I have a div which has 14 child divs with some content. Now what
I want div to be appeared over table cell (filling the entire space of
I had a div with links that underlined once you hover over them. I
I've got this script that needs to be changes to OnMouseOver, currently it functions
I'm working with a platform that does not support onmouseover or onmouseout. I need
I have a table that i want to highlight during onmouseover/onmouseout. I already know
I have a function which is called onmouseover that animates the element that was
I call this functions on onmouseover and onmouseout for several divs. //Takes effect on

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.