Tuesday, 26 January 2021

Ajax - jQuery - Reset Form

 Watch this example on YouTube


 

@model WebApplication1.Models.OrderCustomClass

@using (Ajax.BeginForm("", "",null, new { @id = "frm" }))
{
    <div>
        @Html.TextBoxFor(x => x.or.Column1)
        <br />
        @Html.TextBoxFor(x => x.or.Column2)
        <br />
        
    </div>  
}
<input type="button" id="btnSubmit1" onclick="Reset()" value="Reset Form" />

    @section Scripts{
    <script type="text/javascript">
        function Reset() {
            $('#frm')[0].reset();
        }
    </script>
    }

No comments:

Post a Comment