7.The o Shortcut


#1

var main = function() {
('.article').click(function() { (document).keypress(function(event) {
if(event.which === 111) {
('.current').children('.description').toggle(); }; }); (’.article’).removeClass(‘current’);
('.description').hide(); (this).addClass(‘current’);
(this).children('.description').show(); }); }; (document).ready(main);

Please help me! when i press o it opens description but it keep say o shortcut key didn’t open description.


#2

Hi, you have written your keypress event inside the click event and this is not correct. The keypress event should be another event, outside of the click event: