ajax - how to refresh form on closing jquery dialog box? -
this code :
<script type="text/javascript"> $(function () { $("#divtimezone").dialog({ autoopen: false, modal: true, height: 270, width: 550, close: function () { } }); $("#linkcreate").click(function () { $("#divtimezone").dialog("open"); }); }); </script> <div id="divtimezone"> @html.partial("_create", new aegis.lisa.library.time_zone()) </div>
when close modal popup , reopen textbox values, validators values etc not reset. remain in same state entered values previously. how reset form on close?
add before opening dialog
if ( $("#divtimezone") != undefined){ $("#divtimezone").dialog("destroy").remove(); }
like this.
<script type="text/javascript"> $(function () { $("#linkcreate").click(function () { if ( $("#divtimezone") != undefined){ $("#divtimezone").dialog("destroy").remove(); } $("#divtimezone").dialog({ autoopen: false, modal: true, height: 270, width: 550, close: function () { } }); $("#divtimezone").dialog("open"); }); }); </script>
Comments
Post a Comment