This answer had 2 downvotes and was deleted (you'll need 10k rep to see it). But then the answerer posted the same answer (with a slight edit) as a completely new answer, and it removed his/her downvotes.
Is this allowed/fair? In this particular case the answer is still wrong, but I'm just curious if this is a legal move to delete and repost answers to eliminate downvotes?
First Answer
Something like this should work:
Raw:
function modify() { var el = document.getElementById("divId"); e1.firstChild.nodeValue == "changed content."; } var el = document.getElementById("divId"); el.addEventListener("mouseenter mouseleave", modify, false);
If you're using jQuery for already existing functionality it can be smooth to use:
$("#divId").on("mouseenter mouseleave", function() { $(this).html("<p>New content</p>"); });
Second Answer
Something like this should work:
function modify() { var el = document.getElementById("divId"); e1.nodeValue == "changed content."; } var el = document.getElementById("divId"); el.addEventListener("mouseenter", modify, false);