title: How to call a function after validate field using jquery validation plugin
body: <p>hi i am using jquery validation plugin </p>
  
  <p><a href="http://docs.jquery.com/Plugins/validation" rel="nofollow">http://docs.jquery.com/Plugins/validation</a></p>
  
  <p>i want to call to a function after validate a field . like this. </p>
  
  <p>i have a field called city </p>
  
  <pre><code>&lt;input type="text" name="city" class="city" id="input_1"&gt;
  </code></pre>
  
  <p>i want to call to another function after validate this field </p>
  
  <p>this is my code </p>
  
  <pre><code>var x=jq("#contactinfo").validate({
      rules: {
  
          city: {
              required:{
                  depends: function(){
                                  return ((type == "Single Store &amp; Venue") || (type == "Chain Store &amp; Venue")|| (type == "Department Store"));
                           }
                      },
              minlength: 3,
              maxlength: 50                   
          },
     },
  
      messages: {
  
          city: {
              required: "Enter City",
              minlength: "min length 3"
          },
      }
  }); 
  </code></pre>
  
  <p>if i type less than 3 characters . it gives me the error</p>
  
  <blockquote>
    <p>min length 3</p>
  </blockquote>
  
  <p>if no characters in the input it gives me the error </p>
  
  <blockquote>
    <p>Enter City</p>
  </blockquote>
  
  <p>i want to call to another function after that like <code>change_background_color()</code></p>
  
  <pre><code>function change_background_color() {
  
      $('.city').css('background-color','blue');
  
  }
  </code></pre>
  
  <p>how to do this . please help me , i tried so hard and failed ........ thanks </p>
  
  <p>UPDATE </p>
  
  <p>the actual problem is i have global variable </p>
  
  <pre><code>var city_value = 0;
  </code></pre>
  
  <p>it is increments and sets to 1 in the application .</p>
  
  <p>i want to call a function when it is 1 ,i want to remove the error messaege of <code>city</code> input box by calling a function when <code>city_value</code> is 1 . </p>
  
  <p>i need a solution like this </p>
  
  <pre><code>    rules: {
  
          city: {
              required:true,
              minlength: 3,
              maxlength: 50                  
          },
           messages: {
  
          city: {
              required: "Enter City",
              minlength: "min length 3"
          },
      }
     },
  </code></pre>
  
  <p>i want to call a method after this error message created . </p>
  
  <p>in my function what i do is </p>
  
  <pre><code>function remove_city_error(){
  
        if(city_value ==1){
  
          $('.city').next('.error').remove();
        }
  </code></pre>
  
  <p>that's what i need . please help </p>
  
  <p>}</p>