validation - Enabling/disabling a button with jquery.validationEngine -


i'm using this jquery form validator cannot understand how make 1 simple thing here: if form not valid disable submit button, otherwise enable submit button.

a little bit of code:

<script type="text/javascript"> $(document).ready(function() {     $("#registration_form").validationengine({         //     }); }); </script>  <?php echo "<form id=\"registration_form\">";  echo "<label for=\"name\">name</label>"; echo "<input class=\"validate[required,custom[onlyletter],length[3,100]]\" id=\"name\"><br />";  echo "<button type=\"submit\" id=\"submit_button\">go</button>"; echo "</form>"; ?> 

this script

 <script type="text/javascript">     $(document).ready(function() {         $("#registration_form").validationengine(     {         inlinevalidation: true         });     $('.change').change(function() {         validate();     });     validate();      });      function validate(){      var res = $.validationengine.loadvalidation("#name");      if (!res)          $("#submit_button").attr('disabled','');       else          $("#submit_button").attr("disabled","disabled");   }  </script> 

in body

<input class="validate[required,custom[onlyletter],length[3,100]] change"     id="name" value=""><br />    

try , feedback me


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -