重置按钮的js写法

<button type="button" onclick="ClearTextBox()">重置</button>

<script>
 $("#createDateBegin").datepicker();
 $("#createDateEnd").datepicker();
 
 function ShowProjectDetail(id){
  window.showModalDialog("<s:property value='basePath'/>contacts/orgMgr!showProject?projectId="+id,null,"dialogHeight: 600px; dialogWidth: 800px;center=yes");
 }
 
 function ClearTextBox(){  
  $("#contactId").val("");
  var inputs = document.all.tags("INPUT");  
  for(var i=0; i < inputs.length; i++) {
    if (inputs[i].type == "text") {
    inputs[i].value = ""; }
   if (inputs[i].type == "checkbox") {
    inputs[i].value = null; }  
  }
    
  var inputs = document.all.tags("TEXTAREA");  
  for(var i=0; i < inputs.length; i++)  
  inputs[i].value = "";  
 }
</script>

===============================================================

$(function() {

 $("#resetBtn").button({icons : {primary : "ui-icon-tag"}});

 $("#resetBtn").click(function(){
  $(':input','#tagForm').not(':button, :submit, :reset').val('').removeAttr('checked').removeAttr('selected');
 });

});

原文地址:https://www.cnblogs.com/guanghuiqq/p/2555199.html