Check if Field is empty or Not in Javascript::
$(“#search-form”).on(‘submit’, function(){
var dis = $(this);
searchbox = dis.find(“input[name=’product_ name’]”).val();
var submitform = true;
$(“#search-form-msg”).css(‘ color’,’red’);
if(searchbox.trim().length == 0){
submitform = false;
$(“#search-form-msg”).html(“ Please type to a product search”);
}
return submitform;
})