Hi Eric,

It could be that you haven't included the rest of the code that actually binds the click handlers to those elements. It's probably not entirely clear that the code snippet isn't sufficient by itself to trigger the style switching. It needs the previous code along with it. Sorry about that.

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On May 8, 2009, at 1:52 PM, EricC wrote:


Hi I am currently learning jQuery from the book Learning jQuery 1.3
and I have run across a block of code that is not working for me in FF
or Safari. Here it is copied straight from the book (page 64)

$(document).ready(function() {
$(document).keyup(function(event) {
switch (String.fromCharCode(event.keyCode)) {
case 'D':
$('#switcher-default').click();
break;
case 'N':
$('#switcher-narrow').click();
break;
case 'L':
$('#switcher-large').click();
break;
}
});
});


I tested the next step that accomplishes the same thing with different
code but I would like to understand why this is not working. Any help
would be appreciated.

Cheers,

Eric

Reply via email to