index.html
<body class="teste">
<h1 id="teste-zica">teste</h1>
<h2>teste2</h2>
<h3>teste3</h3>
js.js
addEventListener("mouseover", paradaDeSucesso);
function paradaDeSucesso(event) {
$(event.target).addClass("intro");
this.addEventListener("click", function(){
var x = document.getElementsByClassName("intro")[0].textContent;
$(event.target).removeClass("intro");
});
}
The problem is this: every time my hover
is catching body
, so when I click it it takes the whole value, it was not supposed to happen, there is a way to lock addClass
to tag body
?
PS: What I want to do is to leave the place where the mouse is tagged and as soon as it is clicked grab the contents of that Class, "intro" in case, to use in another function to translate to pounds the content that was clicked.