can you update your HTML file.It ll very helpful to answer. actually blur is very powerful event in jquery, you might or may setting focus on several filed in your
checkDate
method. it loose focus while working with several field.
i dont kwon whether you by mistake written
if(!checkDate($("txtDate").val()))
, coz you have missed
# before your textfield id..
$("
#txtDate")
mean while you can try this.
$(function(){
alert(checkDate($("txtDate").val()));
if(!checkDate($("#txtDate").val()))
{
$("#someothercontrol").focus();
alert("Invalid Date");
$("#txtDate").val("");
$('#txtDate').focus();
}
});
If you are using ajax or some server side validation,
it wont work you have to aply some little tricks like for ajax you have to synchronize ajax method before client side validation.
and you can also use setinterval or settimeout method of java script for setting focus. please ckeck it
setTimeout(function() {
$('#txtDate').focus();
}, 0);
Thnks,
deepak