برای اینکار از این کد استفاده می کنیم :
$("#send_file").on("click",function (){ event.preventDefault(); //validate fields var fail = false; var fail_log = ''; var name; $( '#send_file_form' ).find( 'select, textarea, input' ).each(function(){ if( ! $( this ).prop( 'required' )){ } else { if ( ! $( this ).val() ) { fail = true; name = $( this ).attr( 'name' ); fail_log += name + " is required \n"; } } }); //submit if fail never got set to true if ( ! fail ) { // execute code here } else { alert( fail_log ); } }); });