V. Lernout
V. Lernout

Reputation: 57

Clear modal form textbox from value on closing event

I have a "Subscribe" modal form that opens when the users clicks on "Inscription" and I wish that the data typed in it by the user disappears or the modal 'resets' the value when it's closed.

I tried multiple options but nothing worked.

Here is a link to a fiddle: 

http://jsfiddle.net/0tekp47g/3/

solution:

http://jsfiddle.net/0tekp47g/29/

Upvotes: 1

Views: 325

Answers (1)

chaosifier
chaosifier

Reputation: 2964

This should do the trick:

$('.modal').on('hidden.bs.modal', function () {
    $(".modal input").val("");
    $('.modal select').val("");
});

Try it on JSFiddle.

Upvotes: 1

Related Questions