I have this code on my web page:
$(document).keypress(function(e){
if (e.which == 13){
if ($('#title').is(":focus"))
{
$("#save_post").focus().click();
$('div .jqEasyCounterMsg').css('visibility','hidden');
}
else if ($('#s').is(":focus"))
{
$("#searchAddress").focus().click();
}
}
});
This works in every single browser except older versions of IE (8 and older). What should I change to get this to work in those versions?
Place your event handler code within a
$(document).ready(...block and it should work.See http://api.jquery.com/ready/