say for required field for Username textbox.
function validate()
{
var txtValue = $('#txtUsername').val();
if (txtValue == '' || txtValue == null || txtValue == undefined)
{
alert ('Username is required.');
$('#dvUsernameMessage').html('Username is required.');
}
}