I want to do form validation without using these many if else conditions, I want to use single if-else condition is it possible?.
if($( "#firstname" ).val() == "") {
$('#dateofbirth').html("Please enter date of birth.");
}
else
{
$('#dateofbirth').empty();
}
if($( "#lastname" ).val() == "") {
$('#employeetypeid').html("Please select employee type.");
}
else
{
$('#employeetypeid').empty();
}
if($( "#username" ).val() == "") {
$('#worklocationid').html("Please select work location.");
}
else
{
$('#worklocationid').empty();
}
if($( "#passwordConfirmation" ).val() == "") {
$('#departmentid').html("Please select organization/dept.");
}
else
{
$('#passwordConfirmation').empty();
}`