I have encountered an issue with a div I create on my page using javscript when the mouse hovers over a specific area. It seems that this newly created div does not adhere to the styles defined in my css sheet, despite assigning it an id. Is there a way to ensure that my css styles apply to this div? Thank you. Code:
// Function triggered by mouseover event:
function showMyToolTip(mouseXPosition, mouseYposition){
// Check if mouse is over object at objLocationX, objLocationY
if (mouseXPosition == objLocationX&& mouseYPosition == objLocationY){
var div = document.createElement("div");
div.setAttribute("id", "divMouseOverObj");
document.appendChild(div);
}
}
CSS stylesheet: div#divMouseOverObj{ width: 100px; color: green; }