I want to show an error message but want to format the fields depending upon condition below
error message is
 ("Record is already present for no"+ $('#Number').val() + " emp1"+ $('#emp1').val() +" emp2"+ $('#emp2').val() +" out date "+ $('#outdate').val() + " indate "+ $('#indate').val());
output is :
Record is already present for no 123 emp1 AAA emp2 BBB out date 2MAY indate 5MAY
now if i'm not passing emp2 name in the textbox 
so value is null for emp2 how can i remove emp2 also from my above message ?
I tried with $('#emp2')==null but at the time of showing how can I delete emp2 which i have taken it into string or how can i reformat my error message ?
 
     
     
    