Keypress g shortcut. What am I doing wrong?


#1

Hello there!
I was working on the g keypress exercise to get the like button to work.
But even after checking various posts on this site, I still can't figure out what I'm doing wrong to make the code work...

var main = function() {
  $(document).keypress(function(event) {
		if(event.which === 103) {
			$(".btn").toggleClass("btn-like");

	  });
};

$(document).ready(main);

link

What am I doing wrong?


#2

Hi @voidconscious,

Please post a link to the exercise you're on so we can help you :slight_smile:


#3

Here's the link:

-exercise link-


#4

Check your curly braces ({}) for the if statement - you need to close it :slight_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.