Search Results

Search found 1 results on 1 pages for 'kpomka'.

Page 1/1 | 1 

  • jQuery dynamic validation

    - by kpomka
    Hi there Im trying to do a few things with jQuery validation plugin and seems stuck on one place. Here is some code: <script type="text/javascript"> $(document).ready(function(){ $('#myform').validate(); $('#email').rules('add', {required: true, messages: {required: 'email is required'}} ); $('#phone').rules('add', {required: true, messages: {required: 'phone is required'}} ); $('#validate').click(function(){ $('#result').text($('#myform').validate().form()); return false; }); }); </script> <form id="myform"> <div>email:<input type="text" id="email" /></div> <div>phone:<input type="text" id="phone" /></div> <div id="result"></div> <input id="valdate" type="image" src="images/submit.png" /> </form> As a result i keep getting a wrong error message. If i click on submit button 'phone is required' is shown near email input and 'email is required' isnt shown at all. Whats wrong with this code ?

    Read the article

1