I have a problem with the following code:
<li>
<a href="http://example.com" id="webd">
<span class="hot">W</span>eb Development
</a>
</li>
..................
<p class='web' > Web for all</p>
CSS file :
.hover {
background: #000;
}
.hot{
text-decoration:underline;
}`
Javascript file :
$('body').keypress(function(event){
if(String.fromCharCode(event.which)=="w" || String.fromCharCode(event.which)=="W")
{
$('#webd').hover();
}........
.....
}
$('#webd').hover(function(event)
{
$('.web').show();
$('.prog').hide();
$('.rdbms').hide();
$('#webd').addClass('hover');
}, function()
{
$('#webd').removeClass('hover');
});
Even though with
alert(String.fromCharCode(event.which))
I get w or W
manually calling hover()
doesn't work. The text 'Web for all' isn't being displayed....
Can anyone explain that? Thank you in advance!