Hello, welcome to therichpost.com. In this post, I will tell you, Best way to reset form in Bootstrap Popup modal after modal close. Bootstrap is the most popular front-end framework.
I was facing one problem that, how to reset form in Bootstrap Popup modal after modal close? and I tried all the ways but I did not get any success then I got one jquery trick in mind and I will share that today and this one esay and clean.
Here is the trick for reset form in Bootstrap Popup modal after modal close:
//Code for open bootstrap modal pop up var modalHtml = ""; // this is varibale, in which we will save modal html before open $("#btnId").on('click', function() { modalHtml = $("#modalpop").html(); $("#modalpop").modal("show"); }); //Code for close bootstrap modal popup $("#modapop").on("hidden.bs.modal", function () { //here you can get old html of you modal popup $("#modalpop").html(modalHtml);// In this, we are adding old html in modal pop for achieving reset trick });
There are so many code in bootstrap and I will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com
Leave a Reply