Javascript 如何使用jQuery重置我的Ajax.Begin表单字段值

Javascript 如何使用jQuery重置我的Ajax.Begin表单字段值,javascript,jquery,razor,Javascript,Jquery,Razor,我的asp.net mvc razor视图中有以下Ajax.BeginForm:- <div id="searchform"> @using (Ajax.BeginForm("AdvanceSearchIndexByName","Home", new AjaxOptions { HttpMethod = "get", InsertionMode = Inserti

我的asp.net mvc razor视图中有以下Ajax.BeginForm:-

    <div id="searchform">                           

    @using (Ajax.BeginForm("AdvanceSearchIndexByName","Home", 
    new AjaxOptions
    {
        HttpMethod = "get",
        InsertionMode = InsertionMode.Replace,
        LoadingElementId = "progress2",
        UpdateTargetId = "SearchTable2"
    }))
    {
       }
<input class="btn btn-success" type="submit" value="Clear" id="clear" />

@使用(Ajax.beginnform(“AdvanceSearchIndexByName”、“Home”,
新选择
{
HttpMethod=“get”,
InsertionMode=InsertionMode.Replace,
LoadingElementId=“progress2”,
UpdateTargetId=“SearchTable2”
}))
{
}
我编写了以下javaScript:-

<script type="text/javascript">

    $("#clear").on('click', function () {
        alert('2');
        $('#searchform').clear();
});
        </script>

$(“#清除”)。在('click',函数(){
警报(“2”);
$('#searchform').clear();
});
单击“清除”按钮时重置表单值,但当前“清除”按钮将不起任何作用。有人可以提供建议吗?
谢谢

您无需任何JavaScript即可完成此操作,只需添加一个

@使用(Ajax.beginnform(“AdvanceSearchIndexByName”,“Home”,
新选择
{
HttpMethod=“get”,
InsertionMode=InsertionMode.Replace,
LoadingElementId=“progress2”,
UpdateTargetId=“SearchTable2”
}))
{
}

也许这是一个有用的答案,这正是我一直在寻找的,奇怪的是,我一直在许多项目上使用Ajax.BeginForm,但从来不知道它的重置功能…这是一个HTML 4.0功能!这已经存在很长时间了。人们只是忘记了它。
 @using (Ajax.BeginForm("AdvanceSearchIndexByName","Home", 
    new AjaxOptions
    {
        HttpMethod = "get",
        InsertionMode = InsertionMode.Replace,
        LoadingElementId = "progress2",
        UpdateTargetId = "SearchTable2"
    }))
 {
        <input type="reset" value="reset"/>

 }