Stuck on G key event to toggleClass("btn-like")


#1



I've been stuck on this for way too long. Have tried lots of different variations. Very much a newb here. Any suggestions would be highly appreciated.


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

$(document).ready(main);


#2

Hi @compreal,

You haven't closed your $(document).keypress(...); piece of code :slight_smile: