Clear Boostrap Modal on Hide or Close

 
  1. $("#myModal").on("hidden.bs.modal"function () {  
  1.         $("#guest_form input[type='text'],input[type='password']").val('');  
  2.         $("#guest_form input[type='text'],input[type='password']").each(function () {  
  3.             $(this).removeClass('form-control input-validation-error');  
  4.             $(this).addClass("form-control");  
  5.         });  
  6.         $(".field-validation-error").text('');  
  7.     });  

Initially my modal looks as follows

On submitting the modal without entering any data here my modal looks as follows

On closing the modal and opening it again I am still seeing the errors on my modal

What I need is I would like to clear all the validations and the classes which got applied using MVC validations so that it should again show me the original screen as follows

 
Try the above code and give a try, which will clear all the errors and entered text when you close and open the modal again