I'm in the process of building a very simple blogging tool for my personal website. One feature I'm working on is a comments section. Next to each blog post on my website is a button that, once clicked, shows the comments for that particular blog post.
The comment buttons are created dynamically in javascript with
var commentLinks = document.createElement("INPUT");
commentLinks.setAttribute("type", "image");
commentLinks.setAttribute("src", "linkredacted");
commentLinks.setAttribute("id", "commentButton"+i);
commentLinks.addEventListener("onmouseover", function(){
changeSrc(commentLinks);
}, false);
The problem I am facing is that the mouseover event never fires. I have verified that my URL paths are correct and that the original button is created successfully, but no matter what I try I cannot get the button to resize after the mouseover event. Here is the changeSrc function that the code above calls:
function changeSrc(commentLinks)
{
commentLinks.src = "linkredacted";
}
I have also tried using setAttribute which did not work, as well as placing the entirety of the function call in one anonymous function, which also did not work. Any help would be greatly appreciated