title: how to validate the fields when I click on a button at the first time?
body: <p>Validation of the fields education and moral education takes place when I click on the button at the second time.</p>
  
  <p>I want the validation to take place when I click on the button at the first time.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>$('body').on('change', '#education', function(){
      if( !$("#education").val() ) {
          $(this).closest('.form-group').addClass('has-error');   
      }else{
          $(this).closest('.form-group').removeClass('has-error');
      }
  });
  
  $('body').on('change', '#moraleducation', function(){
      if( !$("#moraleducation").val() ) { 
          $(this).closest('.form-group').addClass('has-error');
      }else{
          $(this).closest('.form-group').removeClass('has-error');
      }
  });
  
  //education
  $('body').on('click', '#update', function(){
      if($("body #education").hasClass('parsley-error')){
          $("body #education").closest('.form-group').addClass('has-error');
      }  
  });
  
  //moraleducation
  $('body').on('click', '#update', function(){
      if($("#moraleducation").hasClass('parsley-error')){
          $("#moraleducation").closest('.form-group').addClass('has-error');
      }   
  });
  </code></pre>