Questions with jquery validation

Questions with jquery validation

Hi,
I am new with jquery.
When I clicked on the alert box OK I would redirect to another page. Any suggestion on how to stay back on the current page? 
And how to add if no value is selected there's no need any alert box needed?
Now if no value is selected then it will pop out a plain box.

$
( document ) . ready ( function ( ) {
    $("#btn").click(function(){
        var msg="";
        $("[name*=Date]").each(function(iitem){
            if(item.selectedIndex>)
            {
               if($(item).closest("tr").find("input[name*=Msg]").val()=="")
               {
                  msg=msg+"Please provide a message for "+$(item).closest("tr").find(".h3").html()+"\n";
               }         
            }
        });
        alert(msg);
    });
})