javascript - jquery clear the validate error message on reset -


i have jsp follows:

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <script src="${pagecontext.request.contextpath}/jquery/jquery.js"></script> <script src="${pagecontext.request.contextpath}/jquery/jquery.validate.min.js"></script>  <script type="text/javascript" language="javascript">  jquery(document).ready(function () {  //......   ..../// $("#apiid").validate({ rules: {     pinnbr: "required",     trandt: "required" }, messages: {     pinnbr:"please enter pin number.",     trandt: "please enter tran date."     } });   $("#resetid").click(function () { var validator = $('#apiid'); validator.resetform(); }); });  </script>  <form:form id="apiid" action="executeapi.do" commandname="apiform">  //..  <div class="label">pin number:&nbsp;</div><div class="nonlabel"><form:input path="pinnbr" maxlength="50" size="40" /></div> <div class="label">todays transaction:&nbsp;</div><div class="nonlabel"><form:input path="trandt" size="10" maxlength="10" />  ..//  <div class="btn-group">         <button id="submitid"  type="submit" class="default-button">submit         </button>         <button id="resetid"               type="reset" class="default-button">reset         </button>     </div> </form:form>  

when not enter values pinnumber , trandt error message inline input field using validate(). once click reset want inline error messages disappear. resetform() resets values in input fields button not error message. button reset resets path variables not these error messages.

try :

form.find('label.error').remove(); 

update 1 :

try add line code after validator.resetform(); form.find(".error").removeclass("error");


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -