LeBronPark LeBronPark - 3 years ago 83
jQuery Question

How can i fix code in jQuery.validator

I want to check validation when user sign up. so, code is

<span class="input_label">
<input type="text" name="firstname" id="firstname" required="required">
<label>FIRST NAME *</label>
</span>


and use jQuery.validator.

after that code is appeared

<span class="input_label">
<input type="text" name="firstname" id="firstname" required="required">
<label>FIRST NAME *</label>
</span>
<div for="firstname" class="tooltip">Please enter your first name</div>


class="tooltip" is i add errorClass: 'tooltip', errorElement: 'div',

How do i have to do.. if I insert code Please enter your first name in tag?

Answer Source

Take a look at the messages parameter for the validate() function config.

$('#form_id').validate({
   messages: {
      firstname: "Please enter your first name"
   },
   errorClass: 'tooltip',
   errorElement: 'div'
});

You could also use the errorPlacement parameter to programatically position the new element as needed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download