jquery validate errorplacement with a specific place -


i want validate form jquery validate want put error label specific place. example below show error label put in <span class="error_label"></span>. question how can make errorplacement specific place, example below, please me..thanks?

<script> $(document).ready(function (){ $("#fm_regis").validate({     rules :{         name: {             required: true,         },     },     errorplacement: function(error, element) {               //$(element).next('span .error_label :first').html(error);         //$('.error_label').html(error);         //$('.error_label').html(error);         $(element).closest('.error_label').html(error);     },     messages: {         name: {             required: "please input username",         },     } }); }); </script>      <form name="fm_regis" id="fm_regis">     <table>          <tr>          <td width="100">nama</td>          <td>:</td>          <td><input type="text" name="name" id="name" size="30"/></td>       </tr>        <tr>          <td width="100"></td>          <td></td>          <td><span class="error_label"></span></td>       </tr>    </table>      <input type="submit" value="register"/>    </form> 

in specific situation can this:

$(element).closest('tr').next().find('.error_label').html(error); 

http://jsfiddle.net/kqtqu/


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -