javascript - Unloading data from a modal -
i using bootstrap 3.3.2
. how remove data modal
? want modal appear fresh loaded first time.
for example modal :
<div class="modal fade" id="pass" tabindex="-1" role="dialog" aria-labelledby="mypass" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <h4 class="modal-title text-center" id="mypass">characteristics</h4> <div class="modal-body"> <form class='form-inline'> <div class='form-group'> <label for='playernumber_pass'>player number</label> <input type='text' class='form-control' id='playernumber_pass' name='playernumber_pass'/> </div> <label class='checbox-inline'> <input type='checkbox' id='completed' name='completed'>completed </label> </form> </div> </div> </div> </div>
when loaded again has field filled previous data. how make sure, fields , other items inside modal loaded fresh?
here fiddle showing same data loaded again, when modal reloads : fiddle
i tried following, didn't work :
$('#pass').on('hidden.bs.modal', function () { $('#pass').removedata(); })
you cache .html()
of modal , restore on x.bs.modal
event
var modalfreshcontents = $('#pass').html(); // content of modal restored when modal hidden $('#pass').on('hidden.bs.modal', function (e) { $(this).html(modalfreshcontents); });
Comments
Post a Comment