-1

I would like to know why this mouseenter event is never get call. Change the parent to ul tag and everything works

I set up an jsfiddle here http://jsfiddle.net/4vfqgz7x/1/

double-beep
  • 5,031
  • 17
  • 33
  • 41
Loredra L
  • 1,485
  • 2
  • 16
  • 32
  • Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself.** Even jsfiddle may not be available in the future. – freedomn-m Feb 19 '19 at 16:42

1 Answers1

1

The problem is that you cannot have an a element residing within another a element.

<a>
  <li class="complete">1</li>
  <li class="complete">2</li>
  <a>3</a>
  <i>4</i>
</a>

If you run and inspect the above code snippet, you will see the result in the DOM is actually:

<a>
    <li class="complete">1</li>
    <li class="complete">2</li>
</a>
<a>3</a>
<i>4</i>

Thus, your CSS Selector of a > i (select all i elements where the parent is an a element) is not going to work.


Reference: What elements can be contained within a <a> tag?

double-beep
  • 5,031
  • 17
  • 33
  • 41
Gary Thomas
  • 2,291
  • 1
  • 9
  • 21