Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Joseph Bertino
seal-mask
.a{fill-rule:evenodd;}techdegree
Joseph Bertino
Full Stack JavaScript Techdegree Student 14,652 Points

ONLY toggle <span> when hover over <p> parent?

For part (1) of this challenge we are asked to toggle the appearance of the helper text in the <span> element when we hover over the element <p id='helpText'>.

However I noticed that I can hover over the area where the span is located, even when the span is hidden(!), and it will toggle the intended behavior.

The instructor claims that this is the correct behavior, but I would like to know how to design the jQuery code so that the <span> is toggled ONLY when the mouse makes contact with the helper text. In coder terms, I don't want the 'mouseover' event to propagate---or bubble down---to the children of the <p> element. I've tried the following to no avail:

$('p#helpText').on('mouseenter', function(event) {
  $('#helpText span').toggle();
  event.stopPropagation();
});

Any ideas?