Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,169 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!