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!

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

HTML jQuery Basics (2014) Creating a Simple Drawing Application Using on()

Patrick Hayes
Patrick Hayes
7,061 Points

Adding on() to the $(".controls ul ") on line 6 doesn't work


I'm not sure what I'm doing wrong here.

I've appended the code on line 6 to llok like this: $(".controls ul").on("click", "li", function() {... });

It works in the preview but when I check the answer it returns a null value.

Any help would be greatly appreciated.


2 Answers

Gareth Borcherds
Gareth Borcherds
9,372 Points

Although that will also work, they are just looking for

$('.controls').on('click', 'li'. function (){ 

You gotta remember that code challenges sometimes look for a specific text and sometimes a correct answer isn't programmed so just try a different solution if you can think of one.

Patrick Hayes
Patrick Hayes
7,061 Points

Awesome Cheers for that. That works great