I have a iframe in my html page. I have attached key events on my html document.
When I pressed "a" or "z" I can do something like addClass or removeClass.
So in that block when I try to add focus to an iframe it gets added. But with a key event I cannot lose focus (blur) an iframe.
Here is the sample code:
switch (myKey) {
case 'a':
$('div').append("<p>a pressed</p>");
$("iframe").addClass("thick");
$("iframe").focus();
break;
case 'z':
$('div').append("<p>z pressed</p>");
$("iframe").removeClass("thick");
$("iframe").blur();
break;
default:
//console.log('keycode', keycode);
}
Can any one help me and tell me where it is wrong?
Fiddle - http://jsfiddle.net/hgXyq/70/