here is what i have, i figured it would only change red, the one span that the mouse is over, but once you put the mouse over, they all change red
<p><span onmouseover="this.style.background='red'" title="大地(Daichi) ground/earth/the solid earth/the land">(大地) <span onmouseover="this.style.background='red'" title="が(ga) indicates sentence subject / indicates possessive / but/however/still/and">(が) <span onmouseover="this.style.background='red'" title="揺れ(Yure) vibration/flickering/jolting/tremor">(揺れ) <span onmouseover="this.style.background='red'" title="始め(Hajime) beginning/start/outset/opening/ first / origin/ such as .../not to mention ...">(始め) <span onmouseover="this.style.background='red'" title="、(、) Japanese comma">(、) <span onmouseover="this.style.background='red'" title="警報(Keihou) alarm/warning">(警報) <span onmouseover="this.style.background='red'" title="が(ga) indicates sentence subject / indicates possessive / but/however/still/and">(が) <span onmouseover="this.style.background='red'" title="鳴り(Nari) ringing/sound">(鳴り </span>)(<span onmouseover="this.style.background='red'" title="響い(Hibii) no dictionary result, likely a conjigated verb">響い</span>) <span onmouseover="this.style.background='red'" title="た(ta) indicate past completed or action/ indicates light imperative">(た</span>)</p>
how do i make each span change on its own mouseover event?
Your code works, the problem is that you have a
spaninside otherspanand so on.You should add one
spanand then other, so when you pass the mouse over the firstspanit looks like all gets red because they are inside.demo