I have my p tag which suppose to chage text when I trigger mouseover event but somehow I got [object MouseEvent] in return and not the text.
HTML
<p id="album-name-1"
onmouseover="changeText('follow me around, greatest song of the album!')">
change the text
</p>
JS
var par = document.querySelector("#album-name-1");
par.addEventListener("mouseover", changeText);
function changeText(text) {
if (this.id === "album-name-1") {
par.innerHTML = text;
}
}
I wanted to do this with the use of the "this" keyword, but somehow it's not working as I expect it to work. Any suggestions?