jquery mobile reset not clearing form

我很困惑为什么这段代码没有清除成功的表格。 我在data-role =“collapsible”中使用该表单,它应该工作。 有人可以告诉我是否需要添加其他内容以使其在成功调用后重置。 谢谢

$(function() { $("#BRV_brtrv").submit(function() { var send = $(this).serialize(); $.ajax({ type: "POST", url: "boxrtrvajax.php", cache: false, data: send, success: function (data) { if (data == 'No data'){ $('#brtv-result').addClass("result_msg").html('Please fill in all fields'); } else { $('#brtv-result').addClass("result_msg").html("You have successfully retrieved: "+data); $("#BRV_brtrv").get(0).reset();  } }, error:function (xhr, ajaxOptions, thrownError){ jAlert('There was an exception thrown somewhere'); alert(xhr.status); alert(thrownError); } }); return false; }); }); 

完整forms和js在这里: http : //jsfiddle.net/Pg4SV/

+++编辑+++

选项尝试

 $(':input','#BRV_brtrv') .not(':button, :submit, :reset, :hidden') .val('') .removeAttr('checked') .removeAttr('selected'); $("input[type=range]").val(5).slider("refresh"); $("input[type='checkbox']").attr("checked",false).checkboxradio("refresh"); $("input[type='radio']").attr("checked",false).checkboxradio("refresh"); $('#BRV-brtrv-department').selectmenu('refresh'); $(':input,:select', '#BRV_brtrv').removeAttr('checked').removeAttr('selected'); document.getElementById('BRV_brtrv').reset(); $('#BRV_brtrv').get(0).reset(); 

形成

 
<input type="text" name="BRV_brtrvrb" id="BRV_brtrvrb" value="" />
Service Type *
Choose Department <?php while($row = mysql_fetch_array( $BRVdept_result )) { $value=$row['name']; $caption=$row['name']; echo "", $caption, ""; } ?>
Choose Address <?php while($row = mysql_fetch_array( $BRVaddr_result )) { $value=$row['address1_com']. " ". $row['address2_com']. " ". $row['address3_com']. " ". $row['town_com']. " ". $row['postcode_com']; $caption=$row['address1_com']. " ". $row['address2_com']. " ". $row['address3_com']. " ". $row['town_com']. " ". $row['postcode_com']; echo "", $caption, ""; } ?>

您可能在表单中有一个元素,其ID或名称被reset 。 您需要将元素的id或名称重命名为其他内容。