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 One Solution

Loy Yee Ko
Loy Yee Ko
5,814 Points

double click does not add or toggle class with the code the teacher showed.

Here is the problem for me, I have no idea , or is there any souce I could look up to and figure it out ? thanks!

$("ul").on("dbclick","li", function(){
  $(this).toggleClass("strike");
});

2 Answers

Marcus Mayorga
Marcus Mayorga
11,312 Points

You just forgot an 'l' in 'dblclick'

$('ul').on('dblclick', 'li', function() {
  $(this).toggleClass('strike')
});

should work.
The offical documentation for jQuery is pretty good.
https://api.jquery.com/dblclick/
There's a search bar on that site.

I was having trouble getting the double click to work on Chrome but it was because I had the debugger pulled up.. It only works when the developer tools are closed!