Clear form fields with jQuery

前端 未结 30 2706
甜味超标
甜味超标 2020-11-22 15:48

I want to clear all input and textarea fields in a form. It works like the following when using an input button with the reset class:

$(\".reset         


        
30条回答
  •  有刺的猬
    2020-11-22 16:21

    @using (Ajax.BeginForm("Create", "AcceptanceQualityDefect", new AjaxOptions()
    {
        OnSuccess = "ClearInput",
        HttpMethod = "Post",
        UpdateTargetId = "defect-list",
        InsertionMode = InsertionMode.Replace
    }, new { @id = "frmID" })) 
    
    1. frmID is the identification of the form
    2. OnSuccess of the operation we call the JavaScript function with the name "ClearInput"

      
      
    3. if you do both of these right, then you will not be able to stop it from working...

提交回复
热议问题