jquery validation plugin field set using validator.element not working -


i trying validate set of fields in form using below code working first field only:

 var validator = $("#myform").validate({                 rules:                   {                       stat: {                           required: true                       },                       momlastname: {                           required: true                       },                       momfirstname: {                           required: true                       },                       mommaidenname: {                           required: true                       }             } });    $("#btn1").click(function(){                 var validator1 = $( "#myform" ).validate();                  if(validator1.element( "#momlastname" ) && validator1.element( "#stat" )                     && validator1.element( "#momfirstname" )                     && validator1.element( "#mommaidenname" ) {                  alert(122); } 

here html being validated

<form id="myform" method="post" action="/home/child">                         <div id="tabs">                             <ul>                                 <li><a href="#tabs-1" id="tab1">details 1</a></li>                                 <li><a href="#tabs-2" id="tab2">details 2</a></li>                             </ul>                            <div id="tabs-1">                           <h4>mother's marital status</h4>                           <p><input type="radio" name="stat" id="stat1" value="1" /> legally married &nbsp;&nbsp; <input value="2" type="radio" name="stat" id="stat2" /> not legally married</p>                               <p>all name feilds have limit of <strong style="font-weight:bold !important">70 characters</strong>.  if name exceeds this, <a href="#">contact us</a>  complete registration.</p>                         <div ng-app="">                             <h4>current last name of mother</h4>                             <p><span style="font-size:1.5em !important; margin-top:2px !important;">*</span>  enter last name using. <br />                             <input type="text" name="momlastname" id="momlastname" ng-model="momlastname" maxlength="70" /><br />                             <span style="font-size:0.9em !important">number of characters remaining field: {{70 - momlastname.length}}</span>                             </p>                              <h4>given name (s) of mother</h4>                             <p><span style="font-size:1.5em !important; margin-top:2px !important;">*</span>  first , middle names shown on birth certificate. <br />                             <input type="text"  ng-model="momfirstname" name="momfirstname" id="momfirstname" maxlength="70" /><br />                             <span style="font-size:0.9em !important">number of characters remaining field: {{70 - momfirstname.length}}</span>                             </p>                              <h4>maiden last name of mother</h4>                             <p><span style="font-size:1.5em !important; margin-top:2px !important;">*</span>  last name before married <br />                             <input type="text"  ng-model="mommaidenname" id="mommaidenname" name="mommaidenname" maxlength="70" /><br />                             <span style="font-size:0.9em !important">number of characters remaining field: {{70 - mommaidenname.length}}</span>                             </p>                         </div> </form> 

does know why not working?


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -