how to reset form on modal hidden or close? [closed]


I have a form in a modal, when the users clicks submit, thea form will be validated, if its contain errors, it will not be submitted, so the user can click on modal close button or anywhere to close the modal or hide it, then if the user re-open the modal, the validations css will be remains in the form as they was before, so the question is how I can reset the form to be displayed as a clear fom without any validation css, here is a code I used, but didn't worked:

$('#newsletterModal').on('hidden.bs.modal', function () { $('#newsletter')[0].reset(); $('#newsletter') .bootstrapValidator('disableSubmitButtons', false) // Enable the submit buttons .bootstrapValidator('resetForm', true); });


$('#clear-form').on('click', function() { $('#my-form').find('input:text, input:password, select, textarea').val(''); $('#my-form').find('input:radio, input:checkbox').prop('checked', false); });


  • How to fix WCF error: Request for the permission of type 'System.Security.Permissions.Environme
  • find the missing values from a set of values, using SQL
  • Rails: how to validate that only one record on the many side of a one-to-many relationship is flagge
  • Simple validation with SQLAlchemy
  • Removing last ng-form from validation in angularjs
  • What else can I do to troubleshoot a package not importing in python yet imports in ipython while in
  • How to show all edittext error messages at once in android?
  • JS object key sequence
  • How to control Trigger state (Pause, Play) using code (not just buttons)
  • How to replace TouchesBegan with UIGestureRecognizer
  • Suppressing passwd when calling sqlplus from shell script
  • How to remove a SwiftyJSON element?
  • How do I configure context broker accept post requests from my remote sensor?
  • Adjust width of select element according to selected option's width
  • What's the purpose of QString?
  • Tamper-proof configuration files in .NET?
  • Assign variable to the value in HTML
  • Blackberry - Custom EditField Cursor
  • Transactional Create with Validation in ServiceStack Redis Client
  • How to use carriage return with multiple line?
  • Content-Length header not returned from Pylons response
  • JQuery Internet Explorer and ajaxstop
  • Android full screen on only one activity?
  • Android fill_parent issue
  • Ajax Loaded meta Tags
  • Xamarin Forms - UWP Fonts
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Modifying destination and filename of gulp-svg-sprite
  • Perl system calls when running as another user using sudo
  • Can I make an Android app that runs a web view in Chrome 39?
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • jquery mobile loadPage not working
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Arrays break string types in Julia
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • Change div Background jquery
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster