单击按钮重置所有Formdata

我的重置按钮代码是

<input id="clearData" type="button" class="btn" data-add-person-manually-reset="#" value=>    <input type="button" class="btn" data-add-manually="/recipient/person/add" value=>

我想清除以下字段使用jQuery重置div id Clear1和Clear 2字段以清除调用Reset is From div id Clear1

  1. firstName姓氏组织职位

     **From div id Clear2** codeval1 codeval2 codeval3 codeval4 codeval5 addressList5.type 

      
    <div class="row-fluid form-inline control-group hidden" id="addToGroupForm">
    ${group.name}
    <label class="control-label hidden">Added to Group
    ${group.name}



<input type="checkbox" name="visibleToChildren" checked>  
+
 
+
 
+
 
+
 
+
 


 

我想要使​​用的重置jQuery代码就像

 $(function(){ $('#clearData').click(function(){ }); }); 

但是我不知道如何编写代码来重置点击RESET时提到的值

你可以使用reset()

   


JS

  function formReset() { document.getElementById("frm1").reset(); } 

使用type=reset ,在这种情况下, form标签应该在那里。

 


演示

ResetDemo

根据您的自定义要求

对于CodeVal,您可以使用以下代码。 对于arraylist5在ArrayList5中定义一个自定义类,假设araylist ans使用如下。

 $(function(){ $("#clearData").click(function(){ $(".dragControl").val(''); $(".araylist").val(''); }); }); 
 $.each( $("#test input[type=\"text\"]"), function(index, ele){ ele.val(""); }); 

其中“#test”是表单ID

Interesting Posts