Miguel Flores Miguel Flores - 1 year ago 137
Javascript Question

Reset validation messages after close Bootstrap modal

I have a modal with my inputs, I'm using jQuery.Validate to validate my form on submit, my problem is that when I close the modal and then I open the modal again the messages from validation still there, so my question is, how can I reset or hide those messages when I close the modal?

I tried with this but doesn't work

$('#myModal').on('hidden.bs.modal', function () {

How can I solve this?

Here is a sample code to play with.

Answer Source

You can use together jQuery and jQuery Validate's resetForm():

$('#myModal').on('hidden.bs.modal', function () {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download